GroupingPlugin class provides the functionality to group data in a DataTable based on a grouping criteria. It allows expanding and collapsing groups of rows, making it easier to navigate and manage large datasets.
Usage example:
DataTabledataTable = ... // Create a DataTable instance GroupingPlugin groupingPlugin = new GroupingPlugin< >(new GroupSupplier () { {@literal @} Override public String getRecordGroupId(TableRow tableRow) { return tableRow.getModel().getCountry(); // Grouping criteria based on the 'country' field } }, new CellRenderer () { {@literal @} Override public void render(CellInfo cellInfo) { // Custom rendering for the group header cell cellInfo.getElement().textContent = "Group: " + cellInfo.getModel().getCountry(); } }); // Initialize and add the grouping plugin to the DataTable dataTable.addPlugin(groupingPlugin);
T
The data type of the DataTable.
public void GroupingPlugin(GroupSupplier<T> groupSupplier, GroupCellRenderer<T> groupRenderer)
GroupingPlugin instance with the given group supplier and group renderer.
groupSupplier
The supplier for grouping records.
groupRenderer
The cell renderer for rendering group headers.
public void init(DataTable<T> dataTable)
dataTable
The DataTable instance to which this plugin will be added.
public GroupingPlugin<T> setGroupExpandedCollapseIcon(Supplier<ToggleIcon<?, ?>> groupExpandedIconSupplier)
groupExpandedIconSupplier
The supplier for the group expanded/collapse icon.
This GroupingPlugin instance for method chaining.
public void appendRow(DataTable<T> dataTable, TableRow<T> tableRow)
dataTable
The DataTable instance.
tableRow
The TableRow to append.
public void expandAll()
public void collapseAll()
public Map<String, DataGroup<T>> getDataGroups()
A map of data groups.
public void handleEvent(DominoEvent event)
event
The TableEvent to handle.