2 Replies Latest reply on Feb 22, 2008 10:36 AM by quinten jiang

    how to set current page index in datascroller

    piotrwierzbowski Newbie

      Hi, I want to set current page number in datascroller, eg.
      I want to browse table result starting from the 5th page, not as usual from the first one.
      I don't know how to do it :(. Do You know?

        • 1. Re: how to set current page index in datascroller
          Tamer Gür Newbie

          Hi,
          You can do this from 2 way.

          First, you can use Jsf binding.

          Second, you can manipulate the first attribute of datatable.

          in this example datascroller always start from last page

           <rich:dataTable value="#{mybean.list}" var="var" id="testTable" rows="#{mybean.ROW_COUNT_OF_PAGING}" first="#{mybean.firsRowNumberOfDataTable}">
          
          


          in the bean

           private Integer ROW_COUNT_OF_PAGING=20;
           private Integer firsRowNumberOfDataTable;
          
           public void reRenderDataTable(){
           firsRowNumberOfDataTable=list.size() % ROW_COUNT_OF_PAGING==0 ?(list.size()<ROW_COUNT_OF_PAGING ? 0 :list.size()-ROW_COUNT_OF_PAGING):list.size()-(list.size() %ROW_COUNT_OF_PAGING);
           }
          
           public Integer getFirsRowNumberOfDataTable() {
           reRenderDataTable();
           return firsRowNumberOfDataTable;
           }
          
           public Integer getROW_COUNT_OF_PAGING() {
           return ROW_COUNT_OF_PAGING;
           }
          



          • 2. Re: how to set current page index in datascroller
            quinten jiang Newbie

            I also try this function, But it can noly fix to page "2", whatever value you set on first. Is it Bugs?


            Thanks

            Q