if (container instanceof Grid) {
Grid<M> grid = (Grid<M>) container;
if (grid.getView().isRemoteSort()) {
List<? extends SortInfo> sortInfos = grid.getLoader().getSortInfo();
if (sortInfos.size() > 0) {
SortInfo sortInfo = sortInfos.get(0);
String sortField = sortInfo.getSortField();
if (sortField != null && !"".equals(sortField)) {
ColumnConfig<M, ?> column = cm.findColumnConfig(sortField);
if (column != null) {
int index = cm.indexOf(column);
if (index != -1) {
updateSortIcon(index, sortInfo.getSortDir());
}
}
}
}
} else {
StoreSortInfo<M> sortInfo = grid.getView().getSortState();
if (sortInfo != null && sortInfo.getValueProvider() != null) {
ColumnConfig<M, ?> column = grid.getColumnModel().findColumnConfig(sortInfo.getPath());
if (column != null) {
updateSortIcon(grid.getColumnModel().indexOf(column), sortInfo.getDirection());
}
}
}
}