[richfaces-issues] [JBoss JIRA] Commented: (RF-4403) Better support for datatable sorting in DB

David Sheth (JIRA) jira-events at lists.jboss.org
Tue Mar 10 14:17:23 EDT 2009


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

David Sheth commented on RF-4403:
---------------------------------

I noticed something when looking at the generated SQL:  It appears that a pair of queries (one for data, and one for the count) are being run to regenerate the jsf model, and then another pair is being run to get the data for the new page.  Unfortunately, running two variations of the query with every request won't work for use cases where the query is expensive, as it often is.

Perhaps you could integrate SerializableDataModel into your example, to show people how to avoid running that first pair of queries?

Implementation note:  To enable the example to run on JBoss, I set the two jsf jars and the logging jar to the "provided" scope.  To avoid an error message, I changed the destroy method to check if the session is actually still open before closing it.  i.e.   if (session != null && session.isOpen()) {


> Better support for datatable sorting in DB
> ------------------------------------------
>
>                 Key: RF-4403
>                 URL: https://jira.jboss.org/jira/browse/RF-4403
>             Project: RichFaces
>          Issue Type: Feature Request
>    Affects Versions: 3.2.2
>            Reporter: Sei Syvalta
>            Assignee: Ilya Shaikovsky
>             Fix For: 3.3.1
>
>         Attachments: rf4403.zip
>
>
> Currently, there are two options for sorting data in dataTable (with or without paging):
> 1. use sortBy attribute in rich:column. The downside is that the whole data set needs to be loaded from DB for sorting.
> 2. use commandLinks in rich:cloumn. The downside is that you need to manage the icons, direction etc. by yourself (all this is managed by richfaces in case 1.)
> So what I would find very useful would be to get the sort property(ies) to a bean, where it could be used in sql "select ... order by sortProperty limit start maxResults..." clause.
> Some discussion about this is also in RF-2916.
> To conclude, I'm using a custom datamodel with dataTable pagination which loads data lazily and everything is working fine. However, I would like to add sorting to the headers of table, and I would like to do that at the database level, without doing all the ui logic manually (ie. option 2).

-- 
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

        



More information about the richfaces-issues mailing list