DisplayTag
  1. DisplayTag
  2. DISPL-259

Strings should be trimmed before sort

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Duplicate
    • Affects Version/s: 1.0
    • Fix Version/s: 1.1
    • Component/s: Paging/Sorting
    • Labels:
      None

      Description

      When there is no property and no sortProperty on a column, the rows are sorted using the raw text of the column. The text should be trimmed fefore sorting, else the number of whitespaces before the actual text has an impact on the sort.
      For example, if I have a column like this:

        <display:column titleKey="entreprises.type"
                        sortable="true">
          <c:choose>
            <c:when test="${entreprise.type == 1}">
              SARL
            </c:when>
            <c:when test="${entreprise.type == 2}">
              Société
            </c:when>
            <c:otherwise>
              SA
            </c:otherwise>
          </c:choose>
        </display:column>

      The first rows are the one with SA, then the ones with Société and finally the ones with SARL, which isn't alphabetically correct. This is just because the number of white spaces is not the same depending on the enterprise type.

        Activity

        Hide
        fabrizio giustina added a comment -
        Spaces may also be important for some uses, if you need to trims whitespace you easily do that by suppling a custom comparator, see DISPL-18
        Show
        fabrizio giustina added a comment - Spaces may also be important for some uses, if you need to trims whitespace you easily do that by suppling a custom comparator, see DISPL-18

          People

          • Reporter:
            Anonymous
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: