0
我有一個富有問題:選擇組件RichFaces 4.0.0.Final。如何使用java腳本或jQuery來滾動富選中的選項列表?
在滾動並選擇列表中的列表項後,如果我再次打開列表,列表不會自動滾動到所選項目。我必須手動滾動。
任何幫助!
我有一個富有問題:選擇組件RichFaces 4.0.0.Final。如何使用java腳本或jQuery來滾動富選中的選項列表?
在滾動並選擇列表中的列表項後,如果我再次打開列表,列表不會自動滾動到所選項目。我必須手動滾動。
任何幫助!
重寫select.js的__onBtnMouseDown功能解決了該問題:
__onBtnMouseDown: function(e) {
if(!this.popupList.isVisible()) {
var selectedSymbol = this.__getValue();
var selectedSymbolIndex;
var offset = 0;
// loop over list to get selected symbol index
for (var i = 0; i < this.cache.originalValues.length; i++) {
if(this.cache.originalValues[i] == selectedSymbol){
selectedSymbolIndex = i;
}
}
if(this.items.length > 0 && this.enableManualInput) {
$(document.getElementById(this.id+"Items")).empty().append(this.items);
}
this.__showPopup();
if(selectedSymbolIndex >= 0){
offset = selectedSymbolIndex * this.items.get(selectedSymbolIndex).offsetHeight;
this.popupList.__selectByIndex(selectedSymbolIndex);
var parentContainer = $(document.getElementById(this.id + "Items")).parent()[0];
parentContainer.scrollTop = offset;
}
} else {
this.__hidePopup();
}
this.isMouseDown = true;
}
什麼版本的RichFaces的使用?據我記得這是在RichFaces 4.5的一些微版本中實現的。 – Makhiel
RichFaces 4.0.0.Final –
可能重複的[rich:select下拉跳轉到列表中當前選定的項目](http://stackoverflow.com/questions/17718796/richselect-on-drop-down-jump-到目前選定的項目在列表中) – Makhiel