0 Replies Latest reply on Jul 11, 2012 9:45 AM by Roger Lee

    Lazy loading into rich:dataTable (and events on rich:datascroller)

    Roger Lee Apprentice

      I have a Seam (2.2.2) application using Rich Faces 3.3.

       

      I am using the rich:dataTable and which loads all the 6,500 rows from a table. This works fine and using the rich:datascroller I am able to scroll back and forth by page and to end (page 260) and back the beginning. The performance is fine.

       

      However in production I will have to load over 7.5 million rows and the delay in reading all the rows too prohibitive and will create memory problems.

       

      What is the best way to implement some form of Lazy loading on a rich:dataTable, still showing the page numbers on the datascroller. Appreciate it will go up to 375,000 pages.

       

       

      I’ve added an actionListener to the rich:datascroller but can’t seem to get the “button” clicked from the rich:datascroller (back < or forward > one page or to start << or to end >>). I was thinking that if I can get these values I get use;

       

      query.getResultList().subList(fromIndex, toIndex)

       

      In order to retrieve a page at a time, but I would still like the dataTable to show the total number of pages.

       

      Thanks

       

      <<<<< UPDATE >>>>>

       

      Got the Listener working by using;

       




      <rich:datascroller for="documentsDataTable" selectedStyle="font-weight:bold" actionListener="#{documentsBean.scrollListener}" />

       

      And in my SLSB cast the ActionEvent to a DataScrollerEvent.

       

      public final void scrollListener(ActionEvent actionEvent) {

                     DataScrollerEvent dataScrollerEvent = (DataScrollerEvent) actionEvent;

                     log.info("***** scrollListener dataScrollerEvent page = " + dataScrollerEvent.getPage());

      }

       

      This gives me the page number;

       

      13:32:56,103 INFO  [com.bnpparibas.wade.ejb.DocumentsBean] ***** scrollListener dataScrollerEvent page = 260

       

      Still need some way of "populating" the DataTable so it shows the total number of pages from the initial SELECT * FROM table.

       

      Message was edited by: Roger Lee