0 Replies Latest reply on Jun 20, 2008 10:42 AM by leandro godoy

    DataScroller Pagination question

    leandro godoy Apprentice

      Hello staff'm trying to make a layout with datascroller together with the hibernate but not yet received success, see the code:

       public DataModel Paginacao(){
       System.out.println("chamou o metodo..................:");
       HtmlDatascroller htmlDatascroller = (HtmlDatascroller) FacesContext.getCurrentInstance().
       getViewRoot().findComponent("scrollnum");
       System.out.println("getIndexPage..................:"+getIndexPage()+1);
       if ((getIndexPage()+1)== getMaxPages()) {
       System.out.println("getIndexPage..................:"+getIndexPage()+1);
       System.out.println("MaxPage..................:"+getMaxPages());
       setMaxPages(maxPages + 5);
       System.out.println("MaxPages..................:"+getMaxPages());
      
       IDaoNumeracao idao =new DaoNumeracao();
       model =(DataModel) new ListDataModel(idao.ListarTodosPaginados( ( getIndexPage()+1 )*10) );
       setModel(model);
      
       return model;
      
       }
       setMaxPages(5);
       return null;
       }
      


      e o metodo no dao
      @SuppressWarnings("unchecked")
       public List<Numeracao> ListarTodosPaginados(Integer index) {
       session = HibernateUtil.getInstance();
       try{
       List<Numeracao> list =session.createQuery("from Numeracao n order by n.numeracaoid")
       .setFirstResult(index).setMaxResults(50).list();
       return list;
       } finally {
       session.close();
       }
      
       }
      



      o scroller
       <a4j:outputPanel ajaxRendered="true">
       <rich:datascroller id="scrollnum" align="center" for="tbnumeracao"
       maxPages="#{numeracao.maxPages}" style=" width : 739px;" ajaxSingle="true"
       page="#{numeracao.indexPage}" action="#{numeracao.Paginacao}"/>
       </a4j:outputPanel>
      
      


      What happens is that once the last page of the scroll he does select in the bank but does not update the dataSroller, someone could help me?
      you, hugging.