[ 
https://jira.jboss.org/jira/browse/RF-7849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12485277#action_12485277
 ] 

Nick Belaevski commented on RF-7849:
------------------------------------

1. Working demo involving serializable data model + rich:datscroller: 
http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf?tab=dataModel&cid=4830393
ModifiableDataModel uses in-memory sorting, that's why range is indefinite in 
this case - it's unknown how many rows it would need to fetch from data source 
in order to fill the data window for the particular filtering conditions. Check 
this: 
http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf?tab=modifiableDataModel&cid=4830656
 for model that does sorting and filtering just in DB

2. Yes, rich:datascroller relies on the #getRowCount() method to know how many 
rows are there - your model should return correct result. Please take a look at 
UIData#getRowCount():

    /**
     * <p>Return the number of rows in the underlying data model.  If the number
     * of available rows is unknown, return -1.</p>
     *
     * @throws FacesException if an error occurs getting the row count
     */
    public int getRowCount() {

        return (getDataModel().getRowCount());

    }


> datascroller does not calculate its page count correctly when used with 
> dataTable & with SerializableDataModel...
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: RF-7849
>                 URL: https://jira.jboss.org/jira/browse/RF-7849
>             Project: RichFaces
>          Issue Type: Bug
>          Components: component-tables
>    Affects Versions: 3.3.1
>         Environment: Windows XP; Richfaces 3.3.1.GA; MyFaces 1.2.6, facelets 
> 1.1.14.  Project base generated with appfuse v2
>            Reporter: Jérôme JADOULLE
>
> ... or so it seems.
> As others, I am faced with the need to implement a server-side pagination so 
> that only a subset of my data gets fetched from my backend (a Hibernate 3 
> "managed" database).
> I have read the examples explaining how to do this (see the links below) and 
> tried to make them run but I encounter 2 main errors when testing:
> first, when implementing the walk method in the SerializableDataModel, the 
> range parameter always returns 0 as its first row and -1 as the quantity.  
> When investigating in the source code, I found out that my walk method is in 
> fact called by the  "modify" method of the "ModifiableModel" class. 
> Fact is that, the "range" parameter passed to the walk method is always 
> created like this: "new SequenceRange(0, -1)", already meaning that, whatever 
> happens, the values used in the range will be 0 and -1.
> Second point appears when I force the quantity of rows to a predefined value 
> other than -1 (to see if the rest of the system works fine).  When doing 
> this, the 20 first columns correctly get displayed in my table but, even if 
> the getRowCount() method is correctly implemented as well (returning the 
> total quantity of rows in my db), the datascroller uses the 
> UIData.getRowCount() method to calculate the quantity of rows it totally 
> contains (in order to know how to display itself) and this only returns the 
> quantity of items actually present in an ArrayList used to store the rows to 
> display.  
> Meaning that, whatever the quantity of rows present in my system, 
> datascroller always thinks that the size is 20 (in this case).
> Don't know if I am clear enough.  If not, i'll post more information.
> Links followed to understand how to implement the datamodel:
> http://gochev.blogspot.com/2009/08/richfaces-server-side-paging-with.html
> http://eclecticprogrammer.com/2008/06/25/sorting-and-paginating-in-the-database-with-richfaces/

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

_______________________________________________
richfaces-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/richfaces-issues

Reply via email to