-
1. Re: scrollableDataTable custom DataModel and sorting
nbelaevski May 1, 2009 8:32 AM (in response to tw)Hello,
It is entirely possible to skip decoding, using some external code and component attributes; however some features of SDT are likely to break then (e.g. selection). Why not cache data loaded on the decode in model and then use it for encode?
SortField has "name" attribute. Isn't this information enough? -
2. Re: scrollableDataTable custom DataModel and sorting
tw May 1, 2009 1:40 PM (in response to tw)Hi Nick,
The problem I have is that the load(...) method is called twice when I sort the table by clicking on the column header. With a fully database backed sorting, this would force me to first run the query with the previous sort order and then again with the new sort order, which is what I want to avoid. I'm looking for a way to avoid the first query on sorting.
SortField has a name attribute. This contains the value of sortExpression. Since I'm using the columns tag to setup columns dynamically, this will always be an EL expression, not a column name literal. I'm looking for a way to directly reference the respective column w/o EL evaluation within the load method. I think it would be a good enhancement to provide more contextual information to the load method, including the table and column components. -
3. Re: scrollableDataTable custom DataModel and sorting
nbelaevski May 1, 2009 1:59 PM (in response to tw)You can try to use org.ajax4jsf.model.SerializableDataModel. This will allow you to store data used for rendering and not re-fetch it from DB. Please take a look at livedemo example http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf?tab=dataModel&cid=4802772 and another example: https://jira.jboss.org/jira/browse/RF-3314 .
Here is the example that shows fully-functional data table and DB interaction, involving dynamic columns: https://jira.jboss.org/jira/browse/RF-4403 . Please take a look.