dataTable sort issues with sortBy and filterBy columns
Posted: 23 Nov 2010, 09:32
Hi
I am experiencing some peculiarities with sorting columns in a p:dataTable component. I'm wondering if I have coded this incorrectly or whether this is a 2.2.RC2 issue still being resolved.
I have a dataTable (and first column) defined thus:
The table shows the sort indicator within the column heading. When I click on the header the sort indicator changes to show ascending sort. When I click again the sort indicator changes to show descending sort sequence. However the data rows within the table remain unchanged.
If I add a filterBy attribute to the column as:
then clicking the column header shows the same behaviour. However if I enter something into the filter field for the column then the data rows change to match the filter. The sort feature now works for the column (and all other sortable columns). If I now clear the filter field to show the full original set of row data - the sort feature continues to work.
I've only been using Primefaces for a week, converting some existing code to use the components, so I could easily be missing something critical in the code. I would appreciate knowing what I have coded incorrectly or whether this is a 2.2.RC2 issue still being resolved and therefore I will just wait before implementing sorting.
Thank you for your help.
I am experiencing some peculiarities with sorting columns in a p:dataTable component. I'm wondering if I have coded this incorrectly or whether this is a 2.2.RC2 issue still being resolved.
I have a dataTable (and first column) defined thus:
Code: Select all
<p:dataTable id="RecTbl"
binding="#{countryGridBean.grid}"
rows="#{countryGridBean.filterGridRows}"
paginator="true"
paginatorAlwaysVisible="false"
paginatorPosition="both"
pageLinks="4"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
dynamic="true"
value="#{countryGridBean.recs}" var="txn">
<!-- country code -->
<p:column rendered="#{countryGridBean.colCode}"
sortBy="#{txn.ctryCode}">
<f:facet name="header">
<h:outputText value="Code"/>
</f:facet>
<h:outputText value="#{txn.ctryCode}"/>
</p:column>
<!-- other columns-->
If I add a filterBy attribute to the column as:
Code: Select all
<p:column rendered="#{countryGridBean.colCode}"
sortBy="#{txn.ctryCode}" filterBy="#{txn.ctryCode}">
I've only been using Primefaces for a week, converting some existing code to use the components, so I could easily be missing something critical in the code. I would appreciate knowing what I have coded incorrectly or whether this is a 2.2.RC2 issue still being resolved and therefore I will just wait before implementing sorting.
Thank you for your help.