Thanks. I'll digest that and think about whether I can find a way to  
make it work. As I said, I did try a work around by not using a  
comparator, just making what I returned Comparable, but the compareTo  
method was never called DT calls the toString method and then sorts on  
that - which makes a comparator necessary.

I do need the decorator (I'll have to think of a way I can do without  
it) because the date can be null. If the date is null then the  
decorator returns 'ASAP', which brings us to the reason for the  
comparator which places all 'ASAP' dates before other dates - which is  
the reverse of the natural sort order (numbers first, then alpha chars).

On Jan 27, 2009, at 4:20 AM, J Ilari Moilanen wrote:

> Hi
> Have you tried to use the column tag without the decorator? With  
> something
> like this for example
>
> <display:column sortable="true"
> headerClass="sortable" title="Contract Start"
> comparator="mypackage.displaytag.ContractStartDateComparator">
>  <s:date name="%{#attr.contract.startDate}" format="yyyy-MM-dd" />
> </display:column>
>
> (where s:date is struts 2 tag, but you can of course use JSTL or any
> other library).
>
> One would presume that using comparator and decorator for the same  
> column
> is allowed but I have not tried it myself yet...
>
> And of course if you can't make the comparator work you can always  
> fall
> back to not using it at all with something like this
>
> <display:column sortable="true"
> headerClass="sortable" title="Contract Start">
> <!-- <s:date name="%{#attr.contract.startDate}" format="yyyy MM dd  
> HH:mm:ss" /> -->  <s:date name="%{#attr.contract.startDate}"  
> format="yyyy-MM-dd" />
> </display:column>
>
> but this code is pretty messy :)
>
>
> Ilari
>
>
>
>
>
>> Date: Sun, 25 Jan 2009 15:15:38 -0800
>> From: Developer Dude <developer.d...@comcast.net>
>> Reply-To: displaytag-user@lists.sourceforge.net
>> To: displaytag-user@lists.sourceforge.net
>> Subject: Re: [displaytag-user] Custom Comparator compare() method  
>> for column
>>    not being called??
>>
>> Nobody has any ideas??
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by:
>> SourcForge Community
>> SourceForge wants to tell your story.
>> http://p.sf.net/sfu/sf-spreadtheword
>> _______________________________________________
>> displaytag-user mailing list
>> displaytag-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/displaytag-user
>>
>
>
>
> -- 
>
> "Friends come and go, but enemies accumulate."
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> displaytag-user mailing list
> displaytag-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/displaytag-user


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to