Skip to main content

Row Grouping

The Grid can group rows with equivalent cell values under shared parent rows.

If you want to make a column available for grouping, enable enableRowGroup on its ColDef, otherwise a grouping attempt on this column will result in a runtime exception.

enableRowGroup takes two arguments: true, and a converter Function<String, T> from the group key to the column's Java type T. AG Grid sends group keys as strings, so the adapter uses this converter to turn the key back into the column type when building the query (e.g. a String column uses s -> s, a number column BigDecimal::new / Integer::valueOf, a date column LocalDate::parse).

var priceColumn = ColDef.builder(Entity_.price)
.enableRowGroup(true, BigDecimal::new)
.build();
  • Source code for this grid available here
  • Backend source code available here
Loading grid...

Providing Child Counts​

To enable child counts, you need to set getChildCount on query builder to true, and also provide name of the field where child count will be returned (this is the same field you will use in getChildCount callback in client).

this.queryBuilder = QueryBuilder.builder(Entity.class, Entity_.id, entityManager)
.colDefs(
// colDefs
)
.getChildCount(true)
.getChildCountFieldName("childCount")
.build();
  • Source code for this grid available here
  • Backend source code available here
Loading grid...