lucky
unread,Jun 19, 2012, 8:12:48 AM6/19/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-we...@googlegroups.com
Hi,
I have a requirement that i need to sort celltable data with image, and also when i click on the image i need sort the data again.
Currently i am using the following code:
it will display image but i am not able to sort the data when i click on the image(Like down Arrow and UPArrow)
I am using gwt 2.4
Below is the code snippet:
TextColumn<ResultProxy> nameColumn = new TextColumn<ResultProxy>() {
@Override
public String getValue(ResultProxy object) {
return object.getName();
}
};
resultListGrid.addColumn(nameColumn, "Name");
nameColumn.setSortable(true);
ListHandler<Proxy> columnSortHandler = new ListHandler<ResultProxy>(
resultGrid);
columnSortHandler.setComparator(nameColumn,
new Comparator<ResultProxy>() {
public int compare(ResultProxy o1, ResultProxy o2) {
if (o1 == o2) {
return 0;
}
// Compare the name columns.
if (o1 != null) {
return (o2 != null) ? o1.getName().compareTo(o2.getName()) : 1;
}
return -1;
}
});
resultListGrid.addColumnSortHandler(columnSortHandler);
resultListGrid.getColumnSortList().push(nameColumn);
Let me know do i need to any thing more?