DisplayTag

Case-insensitive sorting

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: None
  • Fix Version/s: 1.1
  • Component/s: Paging/Sorting
  • Labels:
    None

Description

It'd be nice if there were a column-level property indicating that the sorting should be case-insensitive for that column.

Activity

Hide
Guillaume Boudreau added a comment -
I needed this feature too, so I implemented it myself.
I attached the diff file of my modifications. Anyone feel free to turn this into a real patch for displaytag.
Show
Guillaume Boudreau added a comment - I needed this feature too, so I implemented it myself. I attached the diff file of my modifications. Anyone feel free to turn this into a real patch for displaytag.
Hide
Maarten Hogendoorn added a comment -
This feature could be addressed more generically, by adding an attribute "sortComparator" to the display:column tag.
This optional sortComparator should then contain the class that implements a java.util.Comparator interface,
which sorts the specified column according to the order induced by the specified comparator.
Show
Maarten Hogendoorn added a comment - This feature could be addressed more generically, by adding an attribute "sortComparator" to the display:column tag. This optional sortComparator should then contain the class that implements a java.util.Comparator interface, which sorts the specified column according to the order induced by the specified comparator.
Hide
Chidambaram Pl added a comment -
Attaching the sort comparator implementation.
Show
Chidambaram Pl added a comment - Attaching the sort comparator implementation.
Hide
Chidambaram Pl added a comment -
Attaching sort comparator implementation along with tld file 'displaytag-1.0-with-sortComparator-and-tld.zip'
Show
Chidambaram Pl added a comment - Attaching sort comparator implementation along with tld file 'displaytag-1.0-with-sortComparator-and-tld.zip'
Hide
Bruno Braga added a comment -
You forgot of say that sortComparator="org.displaytag.model.CaseInsensitiveRowSorter"

AND ADD
->> public RowSorter(Integer sortedColumnIndex, String beanProperty, TableDecorator tableDecorator, Boolean ascendingOrder)
IN class org.displaytag.model.RowSorter

You factory class requires a Integer and Boolean in contructor, but RowSorter alone had int and boolean

Thank you for the implementation. Be need that.

Bruno Braga
Show
Bruno Braga added a comment - You forgot of say that sortComparator="org.displaytag.model.CaseInsensitiveRowSorter" AND ADD ->> public RowSorter(Integer sortedColumnIndex, String beanProperty, TableDecorator tableDecorator, Boolean ascendingOrder) IN class org.displaytag.model.RowSorter You factory class requires a Integer and Boolean in contructor, but RowSorter alone had int and boolean Thank you for the implementation. Be need that. Bruno Braga
Hide
fabrizio giustina added a comment -
duplicate of DISPL-18
Show
fabrizio giustina added a comment - duplicate of DISPL-18
Hide
Mark Christopher ng added a comment -
Hi

This is a usefull feature that i would also like to use except, it would be more flexible if the user could define the default comparator use in the in the .properties file so the case-insensitive sorting applies for all columns on all display tables used within our project.

Currently we just modified the rowSorter object to do something similar to your CaseInsensitvieRowSorter so it applies to all sorting. It would be cumbersome to add the sortCompartor="org.displaytag.model.CaseInsensitiveRowSorter" to about 100 colums within our project. Let me know what you think because it should be easy to implement.
Show
Mark Christopher ng added a comment - Hi This is a usefull feature that i would also like to use except, it would be more flexible if the user could define the default comparator use in the in the .properties file so the case-insensitive sorting applies for all columns on all display tables used within our project. Currently we just modified the rowSorter object to do something similar to your CaseInsensitvieRowSorter so it applies to all sorting. It would be cumbersome to add the sortCompartor="org.displaytag.model.CaseInsensitiveRowSorter" to about 100 colums within our project. Let me know what you think because it should be easy to implement.
Hide
fabrizio giustina added a comment -
The DefaultComparator used in displaytag 1.1 is configured with a low strength so it will ignore case and accents by default (only if objects are already Strings). Should be ok now.
Show
fabrizio giustina added a comment - The DefaultComparator used in displaytag 1.1 is configured with a low strength so it will ignore case and accents by default (only if objects are already Strings). Should be ok now.

People

Vote (3)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: