Title: Message
Thanks.
 
I don't know about ColumnDecorators in conjunction with if sorting is dome pre or post ColumnDecorator application.  I've found TableDecorators much more useful to my application (the same datasets are shown in multiple places).
 
The comments that I'm adding are for sorting purposes only, and therefore are added by the TableDecorator.  My domain objects know nothing about comments (or should they).
 
All that being said, your last comment concerning that sorting should be applied through architecture, not through trickery, is spot-on.  A column comparator interface should probably be created, along with a few default implementations (e.g.: CaseInsensitiveComparitor).  This interface could be passed to ColumnDecorators and TableDecorators.  Then, when the sorter comes a long, it would use the comparator on the attributes of the beans that make up the rows of the table
 
Just my $0.02
 
JDG
 
 
--
Jay Glanville
Web Developer
(613) 725-2030 x393
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Will Glass-Husain
Sent: Tuesday, August 17, 2004 12:12 PM
To: [EMAIL PROTECTED]
Subject: Re: [displaytag-user] Case Insensitive sorting

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