Hi All,
I am still stucked here. Can someone give me some clue how can I sort a
String date column properly?
I have a date field retrieved as plain String from database. When I try
to sort the "date" column it does not work properly. So I extended
display tag DefaultComparator as follows:
//...
public class DateStringComparator extends DefaultComparator {
public int compare(Object dateOne, Object dateTwo) {
int result = 0;
final String mask = "dd/MM/yyyy HH:mm:ss";
try {
Date d1 = DateWrapper.stringToDate(((String) dateOne).trim(),
mask);
result = d1.compareTo(DateWrapper.stringToDate(((String)
dateTwo)
.trim(), mask));
} catch (ParseException e) { e.priontStackTrace(); }
return result;
}
}
When declaring the String date column I do:
<display:column title="End Date" class="content-table"
media="html csv xml excel pdf rtf" style="width=33%"
comparator="com.app.web.util.DateStringComparator"
sortable="true"
sortProperty="attrEndDate">${vote.attrEndDate}</display:column>
Here comes the problem. The table renders the comparator class name
"com.app.web.util.DateStringComparator" instead of field value. I am
using displaytag-1.1.1-2007-6-7.jar.
What am I missing here dudes? Can someone shed some light here :D
Thanks a lot,
José Renato.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user