我有可排序的列A和B。当用户单击A列进行排序时,我的结果数据应按A列类型排序, B列将显示相关数据。当用户单击B列进行排序时,我的结果数据应按B列类型排序, A列将显示相关数据。我使用GWT DataGrid和AsyncDataProvider将列排序作为GWT 列排序示例。此示例显示单列排序,我想使用一列或多列排序,但我不知道如何确定
哪个列被触发了列排序事件?
在我的 RPC 方法中,
AsyncHandler handler = new AsyncHandler(myGridTable);
myGridTable.addColumnSortHandler(handler);
myGridTable.getColumnSortList().push(A_column);
myGridTable.getColumnSortList().push(B_column);
AsyncDataProvider<AdminModel> provider = new AsyncDataProvider<AdminModel>() {
protected void onRangeChanged(final HasData<AdminModel> display) {
final int start = display.getVisibleRange().getStart();
int length = display.getVisibleRange().getLength();
AsyncCallback<String> callback = new AsyncCallback<String> {
public void onFailure(final Throwable caught) {
Window.alert(caught.getMessage());
}
public void onSuccess(final String result) {
........
updateRowData(start, adminList);
}
};
final ColumnSortList sortList = myGridTable.getColumnSortList();
// Here to determine which column sort
// send request to server
}
};
provider.addDataDisplay(view.getDataGridResults());