Title: Message
That's a creative idea.
 
I thought sorting occurred before the ColumnDecorator was applied?  I think you'd want to make your object itself return the comment.  You could use a ColumnDecorator to remove the comment.
 
Of course, the long term solution is clearly to add some type of comparator reference, but this seems useful in the short term.
 
WILL
----- Original Message -----
Sent: Tuesday, August 17, 2004 4:00 AM
Subject: RE: [displaytag-user] Case Insensitive sorting

Have a look at the thread http://sourceforge.net/mailarchive/forum.php?thread_id=4959726&forum_id=28703.  Basically, in the decorator class, prefix the output with an HTML comment to be used as a sorting index.  For example, if you had an attribute "departmentName", in the decorator for the table, use something like the following:
 
public string getDepartmentName() {
    Department d = (Department) getCurrentRowObject();
    return "<!-- " + d.getDepartmentName().toLowerCase()
        + " -->" + d.getDepartmentName();
}
 
This would return "<!-- shipping --> Shipping" if the department name was shipping.  When display tag tries to sort on this column, it will actually use the entire cells contents (including the comment).  Therefore, sorting will be performed on the lower-cased version of the cell.
 
JDG
 
 
--
Jay Glanville
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jagadeesan, Srinivas (ETW)
Sent: Monday, August 16, 2004 7:18 PM
To: [EMAIL PROTECTED]
Subject: [displaytag-user] Case Insensitive sorting

Hi,
 
I saw a question earlier on implementing case insensitive sorting.
I do not want to wrap my String in a Custom object and implement compareTo, because the data value would be used by other areas of the application.
Is there any way to retain the data values as Strings and still implement case insensitive sorting?
 
Thanks,
Srini

Reply via email to