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