html - rich:select on drop down jump to the currently selected item in list -
we using rich:select
our drop down inputs.
<rich:select id="select" value="#{controller.attrs.value}" > <f:selectitems value="#{controller.attrs.items}" var="foo" itemvalue="#{foo}" itemlabel="#{foo.bar}" /> <f:ajax event="#{ajaxactioncontroller.action}" render="input" /> </rich:select>
our problem when drop down triggered starts first element in list. jump position of selected item.
not possible through conventional means, should work:
<rich:select id="select" onlistshow="l.scrolllist()" onlistclick="l.saveid()">
…
l = window.l || {}; (function() { id = 0; l.saveid = function() { id = #{ rich:component('select') }.list.index; }; l.scrolllist = function() { var list = #{ rich:component('select') }.list, listdiv = $( #{ rich:component('select') }.popuplist.popup ).find(".rf-sel-lst-scrl"), selecteddivpos = $(list.items[id]).position(); listdiv.scrolltop(selecteddivpos.top - 7); }; })(l);
Comments
Post a Comment