use of org.kie.workbench.common.widgets.decoratedgrid.client.widget.events.ToggleMergingEvent in project kie-wb-common by kiegroup.
the class AbstractMergableGridWidget method onSortData.
public void onSortData(SortDataEvent event) {
// Remove grouping, if applicable
if (data.isGrouped()) {
ToggleMergingEvent tme = new ToggleMergingEvent(false);
eventBus.fireEvent(tme);
}
// Sort data
List<SortConfiguration> sortConfiguration = event.getSortConfiguration();
data.sort(sortConfiguration);
redraw();
// Copy data and raise event for underlying model to update itself
List<List<CellValue<? extends Comparable<?>>>> changedData = new ArrayList<List<CellValue<? extends Comparable<?>>>>();
for (DynamicDataRow row : data) {
List<CellValue<? extends Comparable<?>>> changedRow = new ArrayList<CellValue<? extends Comparable<?>>>();
changedData.add(changedRow);
for (int iCol = 0; iCol < row.size(); iCol++) {
CellValue<? extends Comparable<?>> changedCell = row.get(iCol);
changedRow.add(changedCell);
}
}
UpdateModelEvent dce = new UpdateModelEvent(new Coordinate(0, 0), changedData);
eventBus.fireEvent(dce);
}
Aggregations