dataTable and dataScroller problem
ljunior Mar 27, 2008 1:04 PMHi all!
I have a problem with dataTable and dataScroller that I couldn't find a solution.. I have a dataTable that has a dataScroller to control pagination behavior. I put a scrollerListener in my backingbean to get the selected page in the dataScroller:
<rich:datascroller renderIfSinglePage="false" align="right" for="listagem" maxPages="12" fastStep="10"
 pageIndexVar="pageIndex" pagesVar="pages" stepControls="show" fastControls="hide" boundaryControls="show"
 inactiveStyleClass="paginacaoInativa" selectedStyleClass="paginacaoSelecionada"
 styleClass="paginacao" tableStyleClass="paginacaoTabela"
 binding="#{bean.formDataScroller}" id="paginacao" scrollerListener="#{bean.scrollerListener}">
 <f:facet name="first" >
 <h:graphicImage id="a" url="/images/ico_first.gif" title="Primeiro" />
 </f:facet>
 <f:facet name="first_disabled" >
 <h:graphicImage id="b" url="/images/ico_first_off.gif" title="Primeiro" />
 </f:facet>
 <f:facet name="previous" stepControls="hide" boundaryControls="hide">
 <h:graphicImage id="c" url="/images/ico_prior.gif" title="Anterior" />
 </f:facet>
 <f:facet name="previous_disabled">
 <h:graphicImage id="d" url="/images/ico_prior_off.gif" title="Anterior" />
 </f:facet>
 <f:facet name="next">
 <h:graphicImage id="e" url="/images/ico_next.gif" title="Próximo" />
 </f:facet>
 <f:facet name="next_disabled">
 <h:graphicImage id="f" url="/images/ico_next_off.gif" title="Próximo" />
 </f:facet>
 <f:facet name="last">
 <h:graphicImage id="g" url="/images/ico_last.gif" title="Último" />
 </f:facet>
 <f:facet name="last_disabled">
 <h:graphicImage id="h" url="/images/ico_last_off.gif" title="Último" />
 </f:facet>
 </rich:datascroller>
public void scrollerListener(DataScrollerEvent evt){
 System.out.println("New page: " + evt.getNewScrolVal() + " - Old page: " + evt.getOldScrolVal());
 paginaAnterior = evt.getNewScrolVal();
 }
The listener is working. The problem is: my dataTable has a commandLink like that:
<h:commandLink action="#{tipoIndeferimentoFacesBean.excluir}"></h:commandLink>
It executes a delete operation. In that method I tried to go back to the previous page selected in the dataScroller using this:
formDataScroller.setPage(paginaAnterior);
But the dataTable always shows the first page! Is there a way to do this? Am I doing the correct thing?
Regards,
Lourival Júnior
