Static createCreates the table model of a row grouping (see the class description).
rows, levels, columns, aggregations, options
the table model – its body is an AreaModelRowGroups
const tableModel = RowGroupFactory.createTableModel<Sale>({
rows: sales, columnDefs, groupBy: ["region", "produkt"], aggregations: { umsatz: "avg" }
});
const body = tableModel.getBodyModel() as AreaModelRowGroups<Sale>;
body.getGroups()[0].results.umsatz; // 90 – Nord, the average of its three rows
Static updateHides the columns of the grouped properties (and shows the ones that are no longer grouped) and sets the header of
the group column – after body.setGroupBy(…). TableApi.setRowGroupBy calls it for you.
a table model of createTableModel
false if the body is no row grouping
const body = tableModel.getBodyModel() as AreaModelRowGroups<Sale>;
body.setGroupBy(["produkt"]);
RowGroupFactory.updateLayout(tableModel);
tableApi.recalcWrappers();
tableApi.repaintHard();
Creates a table model that groups flat rows: one row per group with an arrow, a label (
"Nord (3)") and aggregates per column, below it the sub-groups or the original rows – plus a total row. MIT-licensed, no dependencies, built on the tree table (AreaModelRowGroups).What the factory does:
hideGroupedColumns), their values are in the group column;aggregations(AreaModelAggregateFooter).Regroup at runtime with TableApi.setRowGroupBy; filter, sort, edit and export as in any table.
Example
Example
See
Live demo: row grouping · Training: Row grouping
Since
1.1.94