use of com.vaadin.data.provider.GridSortOrder in project jmix by jmix-framework.
the class AbstractDataGrid method onSort.
protected void onSort(com.vaadin.event.SortEvent<GridSortOrder<E>> e) {
if (component.getDataProvider() instanceof SortableDataProvider) {
// noinspection unchecked
SortableDataProvider<E> dataProvider = (SortableDataProvider<E>) component.getDataProvider();
List<GridSortOrder<E>> sortOrders = e.getSortOrder();
if (sortOrders.isEmpty()) {
dataProvider.resetSortOrder();
} else {
GridSortOrder<E> sortOrder = sortOrders.get(0);
Column<E> column = getColumnByGridColumn(sortOrder.getSorted());
if (column != null) {
MetaPropertyPath propertyPath = column.getPropertyPath();
boolean ascending = com.vaadin.shared.data.sort.SortDirection.ASCENDING.equals(sortOrder.getDirection());
dataProvider.sort(new Object[] { propertyPath }, new boolean[] { ascending });
}
}
}
List<SortOrder> sortOrders = convertToDataGridSortOrder(e.getSortOrder());
SortEvent event = new SortEvent(AbstractDataGrid.this, sortOrders, e.isUserOriginated());
publish(SortEvent.class, event);
}
Aggregations