4 Replies Latest reply on Jul 16, 2008 8:01 AM by Mike Hanafey

    dataTable column sortBy integer property sorts alphabeticall

    Mike Hanafey Newbie

      In the simple example below property 'count' is int, but when table is sorted it is sorted as though the property were a string. This means for example that 100 sorts as though is is smaller than 2 in an ascending sort:

      <h:form id="theForm">
       <rich:dataTable value="#{tables.classyData}" var="row">
       <rich:column sortBy="#{row.count}">
       <f:facet name="header">Count</f:facet>
       <h:outputText value="#{row.count}"/>
       <rich:column sortBy="#{row.date}">
       <f:facet name="header">Date</f:facet>

      I can see the sort occuring in

      and this confirms the sort is by String.compareToIgnoreCase, but the method shows that in some cases a comparator should be used.

      The same behaviour occurs if the bean returns "Integer" instead of "int", and a "java.util.Date" is also sorted by its toString value.

      This basically renders sorting useless, so I've got to believe I am doing something wrong.

      Help, please!!