I've got this code:
ListHandler<List<String>> columnSortHandler = new ListHandler<List<String>>(list);
for (int k=0; k<10; k++){
IndexedColumn myColumn=new IndexedColumn(k+1);
table.addColumn(myColumn, "col "+k);
myColumn.setSortable(true);
columnSortHandler.setComparator(myColumn, new Comparator<List<String>>() {
public int compare(List<String> o1, List<String> o2) {
return o1.get(0).compareTo(o2.get(0));
}
});
}
When I do the sorting, the sorting action was invoked, the table did the sorting but the orders of values in that column are not correct. So I suspect it could be I put the columnSortHandler.setComparator
inside a loop & that's causing the problem.
How do I fix it?