use of com.haulmont.cuba.gui.components.GroupTable in project cuba by cuba-platform.
the class GroupTableLoader method loadColumns.
@Override
protected List<Table.Column> loadColumns(final Table component, Element columnsElement, CollectionDatasource ds) {
List<Table.Column> columns = new ArrayList<>();
Element groupElement = columnsElement.element("group");
if (groupElement != null) {
columns.addAll(super.loadColumns(component, groupElement, ds));
final List<Object> groupProperties = new ArrayList<>(columns.size());
for (Table.Column column : columns) {
if (column.isCollapsed()) {
String msg = String.format("Can't group by collapsed column: %s", column.getId());
throw new GuiDevelopmentException(msg, context.getFullFrameId());
}
if (column.isGroupAllowed()) {
groupProperties.add(column.getId());
}
}
context.addPostInitTask((context1, window) -> ((GroupTable) component).groupBy(groupProperties.toArray()));
}
columns.addAll(super.loadColumns(component, columnsElement, ds));
return columns;
}
Aggregations