0 Replies Latest reply on Oct 24, 2011 4:41 AM by fremak

    Pagination using DataModel

    fremak Newbie

      Hi all,

      I'm using richfaces for a simple crud application and I would like to add server side pagination.

      I started considering the example I found  here http://richfaces-showcase.appspot.com/richfaces/component-sample.jsf?demo=dataTable&sample=arrangeableModel&skin=ruby.

      First of all, I had some issues, I was not able to extract filterExpression property to the Filter, since the expression type seems to be a Boolean and I got a ClassCastException. At the end, however, I changed a bit the code and it worked...

      Anyway, my question is, where I can find documentation about how the datamodel component works. I mean, I would like to understand when the differtent class methods are called by the framework because I inspected the log I added to the methods implemented by the example classes and I saw that a lot of methods are invoked many times when the page is rendered. And I was wondering whether I can add some caching...I would like to load data only when user add/remove some filter.

      Moreover, I would like to handle pagination in such a way to extract the following information:

      • the number of the first item shown (I mean, if I'm showing the 4th page and I have 15 items for page I would output something like "showing rows from 46 to 60")  
      • the total number of items loaded with the provided filters

       

      Thanks in advance

      Fil