Hi,

I have been using the displaytag taglib for a while and it is really nice.

I tried writing a table decorator for a 'sortable display table', but
realized
that sorting stopped working for the decorated properties.

Here is part of the decorator
public class SchedulableDisplayTagDecorator extends TableDecorator {
    private static SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd
HH:mm");

    public String      getAperiodic() {
        Schedulable  s = (Schedulable) this.getCurrentRowObject();
        if (s == null) return "???";
        return s.isAperiodic() ? "A" : "P";
    }
    public String   getDeadline() {
        Schedulable  s = (Schedulable) this.getCurrentRowObject();
        if (s == null) return "???";
        return s.isAperiodic() ? "" : fmt.format(s.getDeadline());
    }
    . . .
}

I got a NPE during the initial rendering, so I had to check for it
        if (s == null) return "???";
but, it's not clear what to return.


Here is part of the row object interface
public interface Schedulable extends Serializable {
    boolean         isAperiodic();
    Date            getDeadline();
    . . .
}

Finally, here is part of the table
<d:table name="schedulables" defaultsort="4" ...
         decorator="<%= SchedulableDisplayTagDecorator.class.getName() %>" >
        <d:column property="schedulableId"   .../>
        <d:column property="schedulableName" title="Name"
sortable="true" headerClass="sortable" />
        <d:column property="aperiodic"       title="A/P"
sortable="true" headerClass="sortable" />
        <d:column property="deadline"
sortable="true" headerClass="sortable" />
        . . .
</d:table>
The ID and Name columns sort, but the other two don't.


Any help on this is highly appreciated.
Kind regards,
        /jens

=========================================
Jens Riboe, Chief Architect / Goyada AB
-----------------------------------------
Email : [EMAIL PROTECTED]
Phone : +46 (0)8 5551 7215
Mobile: +46 (0)708 1123 81
ICQ   : 174790362
-----------------------------------------
Office: Vasagatan 46
        SE-11120 STOCKHOLM
        Sweden
=========================================



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
displaytag-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to