Hi Isomorphic ,
I want to always sort order by a default field (which is not displayed on grid as a field but part of response) first before any other sort applied on grid. This is the code I tried.
This is not working.
Also tried changedHandler
This solution works first time only. For ex : If I click on Name field to sort then this will sort by "default_order, name" and if I again click on name field then it stays ascending only.
Any suggestion how can I do this. Thanks
I want to always sort order by a default field (which is not displayed on grid as a field but part of response) first before any other sort applied on grid. This is the code I tried.
Code:
addSetSortHandler(event -> {
event.cancel(); //tried cancelling here and at the end of method as well
List<SortSpecifier> specifiers = new ArrayList<>();
specifiers.add(new SortSpecifier("default_order", SortDirection.ASCENDING));
specifiers.addAll(Arrays.asList(event.getSortSpecifiers()));
setSort(specifiers.toArray(new SortSpecifier[0]));
});
Also tried changedHandler
Code:
addSortChangedHandler(event -> {
List<SortSpecifier> specifiers = new ArrayList<>();
specifiers.add(new SortSpecifier("default_order", SortDirection.ASCENDING));
specifiers.addAll(Arrays.asList(event.getSortSpecifiers()));
setSort(specifiers.toArray(new SortSpecifier[0]));
});
Any suggestion how can I do this. Thanks
Comment