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

    dataTable column sortBy integer property sorts alphabeticall

    hanafey

      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>
       <rich:column sortBy="#{row.date}">
       <f:facet name="header">Date</f:facet>
       #{row.date}
       </rich:column>
       </rich:dataTable>
      </h:form>
      


      I can see the sort occuring in
      org.richfaces.model.impl.expressive.WrappedBeanComparator2

      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!!