I need to customized the header sorting result of one column using GXT Local Pagination (PagingModelMemoryProxy). Here is my code:
PagingModelMemoryProxy proxy = new PagingModelMemoryProxy(data) {
@Override
public void load(DataReader<PagingLoadResult<? extends ModelData>> reader, Object loadConfig,
AsyncCallback<PagingLoadResult<? extends ModelData>> callback) {
if (loadConfig instanceof PagingLoadConfig) {
PagingLoadConfig pagingConfig = (PagingLoadConfig) loadConfig;
// sort order must be changed because CRITICAL has lowest number
SortInfo sortInfo = pagingConfig.getSortInfo();
if (ActiveAlarmBean.SEVERITY.equals(sortInfo.getSortField())) {
if (SortDir.ASC == sortInfo.getSortDir()) {
sortInfo.setSortDir(SortDir.DESC);
}
else {
sortInfo.setSortDir(SortDir.ASC);
}
}
}
}
}
But the header sorting (ascending or descending) no longer works after I override "load". What I really wanted to do is when user clicks on Ascending it will do descending sorting behavior and while descending it will also do the opposite which is ascending sorting behavior.