jquery - Primefaces 5 datascroller - Setting scrollHeight with Javascript -
i using primefaces 5 , have lazyloaded data scroller set follows
<p:datascroller value="#{controller.datamodel}" var="item" chunksize="10" lazy="true" mode="inline" scrollheight="100" id="scroller"> </p:datascroller>
i want datascroller scrollheight set take full height of space on page can via javascript , not fixed size of 100.
i have bound window resize method recalculate size , set , works, can't set initially.
the javascript set looks this
$("#scroller > div").css("height", $("#main").height());
and call after component using
<h:outputscript> $("#scroller > div").css("height", $("#main").height()); </h:outputscript>
as stated, works if resize window not when component rendered.
two things coud wrong. having id="scroller"
not render component id="scroller" rather prepend component id e.g. id="form:scroller"
or generic id="j_idt19:scroller"
. selector not good. however, if gets applied on resize, match component well, in case issue caused component being loaded not ready still. either way, following should fix it
<h:outputscript> $(function() {$(".ui-datascroller-content").css("height", "200px");}); </h:outputscript>
you can change selector if you're sure that's not issue
Comments
Post a Comment