-
1. Re: can't get dataTable to sort
nbelaevski Mar 22, 2010 7:03 AM (in response to rseely)Hi Robert,
I think that data table cannot update sort order value by this expression: sortOrder="#{marketDisplayDataBean.getSortOrdering(dispCol,columnIdx)}" and that's causing problems. Try using static map for this.
-
2. Re: can't get dataTable to sort
ilya_shaikovsky Mar 22, 2010 7:06 AM (in response to rseely)if there are some problems listend in server log?
http://livedemo.exadel.com/richfaces-demo/richfaces/columns.jsf - sample which works. So I guess there are problems with your sortBy, sortOrder definitions.
-
3. Re: can't get dataTable to sort
rseely Mar 23, 2010 1:12 PM (in response to nbelaevski)Thanks for the suggestion, Nick, but I can't seem to find a combination of changes to those two that helps. This reworking of my rich:columns element was the closest that I could come to simplifying things:
<rich:columns
value="#{marketDisplayDataBean.filteredDisplayColumns}"
var="dispCol" index="columnIdx" width="#{dispCol.columnWidth}%"
id="mdtColumn#{columnIdx}" sortable="true"
sortBy="#{dataItem.key}" selfSorted="true"
sortOrder="UNSORTED"
styleClass="growthDisplayDataColumn #{dispCol.align=='R' ? 'textAlignRight' : (dispCol.align=='C' ? 'textAlignCenter' : '')} #{marketTree.activeNode.properties.columnSortIndex==columnIdx ? 'highlightedDisplayDataColumn' : ''}">
<f:facet name="header">
<h:outputText value=" " />
</f:facet>
<h:outputText
value="#{dataItem.key}" />
</rich:columns>In this case, dataItem.key is a unique integer, and without the more complex conditions and formatting, it still won't sort. I have a spinner graphic that displays whenever AJAX requests are made to the server, and that spinner appears whenever I click a header to sort; so I know that the table is trying to do something ... I just don't know what. Why would it need to send any information back to the server? Can it not sorts its data client-side?
All best,
Robert
-
4. Re: can't get dataTable to sort
rseely Mar 23, 2010 1:14 PM (in response to ilya_shaikovsky)Thanks for your thoughts, Ilya ... please see my message above to Nick for more on sortBy and sortOrder changes. I think that my problem is that I don't understand what the sort request is making a roundtrip to the server for. Can the dataTable be sorted client-side? Could I be missing something on the server side that it needs?
All best,
Robert
-
5. Re: can't get dataTable to sort
rseely Mar 23, 2010 2:41 PM (in response to ilya_shaikovsky)Also, Ilya, I don't see anything in my server logs.
-
6. Re: can't get dataTable to sort
nbelaevski Mar 23, 2010 4:08 PM (in response to rseely)1 of 1 people found this helpfulRobert,
Sorting is done on the server-side, client-side sorting is not implemented.
Please take a look at this issue: https://jira.jboss.org/jira/browse/RF-6234 .
-
7. Re: can't get dataTable to sort
rseely Mar 24, 2010 8:54 AM (in response to nbelaevski)Thanks, Nick. Is RichFaces sorting the table by itself on the server side, or does my bean need to provide any methods for it to be able to set the newly-sorted values? I did try adding a setter method for the data that's being pulled in, but that didn't seem to help anything. I suppose I'll try setting log4j to trace for RichFaces, and see if it turns up anything interesting.
I'll take a look at your link over the next day or two ... got some new priority rearing its ugly head today.
All best,
Robert
-
8. Re: can't get dataTable to sort
ilya_shaikovsky Mar 25, 2010 5:22 AM (in response to rseely)1 of 1 people found this helpfulModifiable interface should be implemented by your model in order to implement sorting/filtering in your custom model. But RF has defaut implementation and wraps your model handling sorting and filtering if you not provided it. So in simplest case nothing required from you to make your data sortable. If you want to take a look at our models implementations - download sources for richfaces-demo application.
-
9. Re: can't get dataTable to sort
rseely Mar 29, 2010 2:26 PM (in response to nbelaevski)Thanks for the help, guys. It turned out to be the sortOrder issue that's described in the JIRA issue that Nick sent. I did have to try a couple of different approaches, because my first attempt was to map the DisplayColumn entity that's used to define the columns to their respective Orderings in a HashMap and look those up, but that didn't work. When I took the simpler approach of mapping the DisplayColumn's name (a String) to the Orderings, everything worked fine.
All best,
Robert