public int compare(List<String> o1, List<String> o2) {
if (o1 == o2) {
return 0;
}
// Compare the column.
if (o1 != null) {
int index = verbColumn.getIndex();
return (o2 != null) ? o1.get(index).compareTo(o2.get(index)) : 1;
}
return -1;
}
On Monday, April 22, 2013 6:44:32 PM UTC+10, Tom wrote:
--I got these code:///****************************///////////// ListHandler<List<String>> columnSortHandler = new ListHandler<List<String>>(list);columnSortHandler.setComparator(nameColumn, new Comparator<List<String>>() {public int compare(List<String> o1, List<String> o2) {if (o1 == o2) {return 0;}// Compare the name columns.if (o1 != null) {return (o2 != null) ? o1.get(0).compareTo(o2.get(0)) : 1;}return -1;}});table.addColumnSortHandler(columnSortHandler); ///****************************///////////// When sorting column contains iPhone 1, iPhone 2, iPhone 3... then it sorts correctly ie, iPhone 1, iPhone 2, iPhone 3 for ascending & iPhone 3, iPhone 2, iPhone 1 for decendingBut when sorting column contains:1.92 MP3.15 MP AF 0.31 MP3.2 MP5 MP AF and flash1.3 MP1.3 MP2 MP (rear); 0.3 MP (front)1.92 MP AF with flash (rear)it follows no correct order, it didn't even put the 2 "1.3 MP" cell next to each other. The correct order for the above list should be:1.3 MP1.3 MP1.92 MP1.92 MP AF with flash (rear)2 MP (rear); 0.3 MP (front)3.15 MP AF 0.31 MP3.2 MP5 MP AF and flashIs there anything wrong with the code above?
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment