I tried the change to extending a comparator instead of default comparator 
already. It made no difference. Either way the compare method just isn't being 
called. I don't think the types is a problem and I can't remember if I tried 
that (I think I did as I recall the method signature would not allow it as the 
method takes Objects, not anything else).

I am leaving this job next week, so if I get to it I may have to spelunk into 
the DT code, but it is a low priority bug so I doubt it. Personally I would 
chose a GWT table or something like that instead.

Thanks.


 -------------- Original message ----------------------
From: J Ilari Moilanen <imoil...@cc.helsinki.fi>
> Hi
> Yeah sorry. Did not read your post carefully enough. :)
> I still don't see why your comparator does not work since it seems valid.
> You could of course make it extend java.util.Comparator instead of
> DefaultComparator and (if you use java 1.5 or higher) put your compare to
> method compare Dates instead of Objects. But I don't think these things 
> prevent
> the comparator from working...
> 
> But to get the result you want you can dump the comparator altogether by
> putting the decorator return something similar to this
> 
> "<!-- 00000 --> ASAP"
> 
> hwne the date is null. That way the ASAP is in the beginning of the list.
> 
> But of course it would be more useful to you if you cold get the
> comparator itsef working :/
> 
> Ilari
> 
> 
> > Date: Tue, 27 Jan 2009 18:41:43 -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??
> >
> > 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
> >
> 
> 
> 
> -- 
> 
> "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