I know that in the handler's compulsory onSort(SortEvent)
method, you can retrieve the index of the column that was sorted by clicking on the column label. How can you use this to process and sort the data in that column?
As is, I have one column where each cell contains a String representation of the time of day in hh:mm a
format. As is it shows in alphabetical order (10:00 am, 10:00 pm, 11:00 am etc).
public final Table getTable(final ChartsWidget cw) {
Table table = new Table(dataTableObject, TableView.createTableOptions(dataTableObject));
table.addSortHandler(new SortHandler() {
@Override
public void onSort() {
if (getDataTable().getColumnLabel(event.getColumn()).contains("Time")) {
//Do something here
}
}
});
return table;
}
I have not been able to get any farther than this.