-
1. Sortorder in column sorting of extendedDataTable in Richfaces 4 M5
konstantin.mishin Feb 1, 2011 1:37 PM (in response to darcyg)Hi Darcy.
You could use # {rich:component('tableId')}.sort('columnId', ['sortOrder']) JS api.
It should be in your case something like this:
<rich:column sortBy="#{cap.name}" id="name" sortOrder="ascending">
<f:facet name="header">
<a onclick="# {rich:component('tableId')}.sort('name');return false" href="#">Sort by Capital Name</a>
</f:facet>
<h:outputText value="#{cap.name}" />
</rich:column>
-
2. Sortorder in column sorting of extendedDataTable in Richfaces 4 M5
darcyg Feb 2, 2011 6:12 AM (in response to konstantin.mishin)Hi Konstantin,
Thanks for you fast reply. I tried what you have said.But it is not working. If we give sortOrder="ascending", it is always in ascending order. when I clicked on the column header, it is not changeing to descending.....
I'm using rich:extendedDataTable.
<rich:extendedDataTable id="tableId" value="#{testDataModel}"
var="testEntity" sortMode="single" rows="#{formObject.pageSize}"
reRender="datascroller">
<rich:column id="name" label="Name" width="200"
sortBy="#{name}" sortOrder="ascending"
selfSorted="false" >
<f:facet name="header">
<a onclick="# {rich:component('tableId')}.sort('name');return false" href="#">Name</a>
</f:facet>
<h:outputText value="#{testEntity.name}" />
</rich:column>
</rich:extendedDataTable>
-
3. Re: Sortorder in column sorting of extendedDataTable in Richfaces 4 M5
konstantin.mishin Feb 3, 2011 9:28 AM (in response to darcyg)I have added to:
next code:
<rich:column id="model" sortBy="#{car.model}" sortOrder="ascending">
<f:facet name="header">
<a onclick="#{rich:component('table')}.sort('model');return false" href="#">Model</a>
</f:facet>
<h:outputText value="#{car.model}" />
</rich:column>
Sorting is working without problems.
-
4. Sortorder in column sorting of extendedDataTable in Richfaces 4 M5
darcyg Feb 10, 2011 9:07 AM (in response to konstantin.mishin)Hi Konstantin,
We are using extendedDataTable with lazy model(we are extending SerializableDataModel.class and implementing Arrangeable class),
While debugging we found out that in the JSF Phase ' APPLY_REQUEST_VALUES' - sortorder is descending. The sortorder is descending till JSF Phase- 'RENDER_RESPONSE' .
and in the JSF Phase: RENDER_RESPONSE - 6.- extendedDataModel is set to null in UIDataAdaptor.class in resetDataModel() method.It will create extendedDataModel again after that . So it will invoke arrange method again. In that sortOrder is descending so it will change to ascending. That's why it is always in ascending order
-
5. Sortorder in column sorting of extendedDataTable in Richfaces 4 M5
konstantin.mishin Feb 10, 2011 10:22 AM (in response to darcyg)Hi Darcy.
While debugging we found out that in the JSF Phase ' APPLY_REQUEST_VALUES' - sortorder is descending. The sortorder is descending till JSF Phase- 'RENDER_RESPONSE'
Do you mean value of attribute "sortorder" of rich:column or some fields of your model or something else?
In that sortOrder is descending so it will change to ascending.
Clarify this sentence please.
-
6. Sortorder in column sorting of extendedDataTable in Richfaces 4 M5
darcyg Feb 11, 2011 2:04 AM (in response to konstantin.mishin)Hi Konstantin,
Yes, the "sortorder" is the attribute of the rich:column.
Initial value of the sortorder is ascending. When we click on the column for sorting, the request goes through JSF Lifecycle.
In JSF Phase ' APPLY_REQUEST_VALUES' - sortorder is changed to descending and in the phase 'RENDER_RESPONSE'., the sortorder is changed back to the ascending.
-
7. Sortorder in column sorting of extendedDataTable in Richfaces 4 M5
konstantin.mishin Feb 11, 2011 1:27 PM (in response to darcyg)Hi Darcy.
... and in the phase 'RENDER_RESPONSE'., the sortorder is changed back to the ascending.
It shouldn't be. I have never seen this in any our samples.
I suggest you to do the following:
- try to map sortOrder in some bean
- compare your code with our one from richfaces-showcase (in this project the sorting is working without problems)
- create an issue in our jira, if the previous points were unsuccessful. Attach the sample project which we can run to this issue.
-
8. Sortorder in column sorting of extendedDataTable in Richfaces 4 M5
darcyg Feb 17, 2011 1:58 AM (in response to konstantin.mishin)Hi Konstantin,
With bean it is working .As I menation in my post, the showcase http://richfaces-showcase.appspot.com/richfaces/component-sample.jsf?sample=tableSorting&demo=dataTable&skin=blueSky
is also using a bean..But we want a generic approch.........