rich:datascroller binding HtmlDatascroller.getPage() problem
I have jsf 1.2 and richfaces 3.3.3.Final.
I have a binding of rich:datascroller in my java. A weird thing happens though: getPage() method sometimes returns the right page numbers and sometimes the wrong ones. What's wrong with that?
The component in jsf:
<rich:datascroller id="tableScroller" renderIfSinglePage="false" for="projectPlanCreatetable" pageIndexVar="pageNo"
binding="#{ProjectPlanCreateControl.listAction.scroller}" >
<a4j:support event="onpagechange" action="#{ProjectPlanCreateControl.pageChanged}" reRender="visitedPages"
oncomplete="markPages();"/>
</rich:datascroller>
<h:inputHidden id="visitedPages" value="#{ProjectPlanCreateControl.visited}" />
and the javascript:
function markPages(){
var pages = document.getElementById('mainFrm:projectPlanCreatetable:visitedPages').value;
pagesArr = pages.split(",");
for (var i=0; i<pagesArr.length-1; i++){
jQuery('td.rich-datascr-inact').filter(function() {
return jQuery(this).text() == pagesArr[i];
}).css('color','red');
}
}
The java:
public String pageChanged(){
Htm开发者_如何学ClDatascroller scroller = listAction.getScroller();
visited += scroller.getPage() + ",";
return "";
}
OK, found it. I should've used the page attribute to get the page in my Controller, and not binding.
精彩评论