Still cannot get extendedDataTable sorting working correctly
ryanyoder Aug 19, 2011 4:34 PMI have tried this a few different ways and my columns are sorting, but only after being clicked the 3rd time.
If I have columns a,b,c and I click A three times, it now sorts correctly. I can keep clicking the column and the order switches from ascending to descending.
If I then click column b, the UI changes a little and some things get shuffled around but column b is not correctly sorted. It takes two more clicks for things to look right.
I built this component, richSortHeader in order to make it easier to consistently sort tables.
As you can see I am using the componentControl javascript method to do the sorting.
<composite:interface>
<composite:attribute name="id" required="false"/>
<composite:attribute name="tableId" required="true"/>
<composite:attribute name="columnName" required="true"/>
<composite:attribute name="label" required="false"/>
<composite:attribute name="sortOrder" required="true"/>
</composite:interface>
<composite:implementation>
<h:commandLink id="#{cc.attrs.id}" value="#{cc.attrs.label}">
<rich:componentControl event="click" target="#{cc.attrs.tableId}" operation="sort">
<f:param value="#{cc.attrs.columnName}" />
</rich:componentControl>
<h:graphicImage value="/global/images/rfedt-sort#{cc.attrs.sortOrder}.gif" style="border:0px;vertical-align:middle;"/>
</h:commandLink>
</composite:implementation>
On my page I just include this header in the header facet of the column I want to sort.
<rich:column id="userIDColumn" sortBy="#{user.userID}" sortOrder="#{UserList.sortOrder['name']}"
width="150px" headerClass="columnLeft" styleClass="columnLeft" label="#{msg['label.userID']}">
<f:facet name="header">
<myns:richSortHeader id="sortUserID" label="User ID" columnName="userIDColumn" tableId="userTable" sortOrder="#{UserList.sortOrder['name']}"/>
</f:facet>
<h:outputText id="userName" value="#{user.userID}" title="#{user.userID}" />
</rich:column>
The sortOrder just ponts to a backing bean property of type Map<String,SortOrder>.
I have tried other approaches and I keep coming up with the same triple-click issue.
It would be helpful if the demo site included sorting so we could all see it working. I would also like to see the page initialized to a default sort because I think that is not working quite right either. When I initalize my sortOrder map to name, descending it is sorted in the reverse order on page load than when I click the link and the backing bean is set to the same value. Strange.
Any help is appreciated.