Skip to main content

Columns

In order to define which columns should be returned to the client, we need to use ColDefs objects. Each column that we want to include in the AG Grid response must be explicitly defined in the ColDefs.

Defining Columns

Each column is defined using a ColDef object.

PropertyTypeDefaultDescription
field (required)stringThe name of the entity field.
sortablebooleantrueEnables or disables sorting.
filterIFilterAgTextColumnFilterDefines the filter type.
Supports:
✅ Custom IFilter implementations
✅ Built-in filters (e.g., AgNumberColumnFilter)
false (disables filtering)
enableValuebooleanfalseSet to true if you want to be able to row group by this column.
enableRowGroupbooleanfalseSet to true if you want to be able to aggregate by this column.
enablePivotbooleanfalseSet to true if you want to be able to pivot by this column.
allowedAggFuncsSet<AggregationFunction>All availableDefines allowed aggregation functions.

Example Usage

ColDef priceColumn = ColDef.builder()
.field("price")
.sortable(true)
.filter(new AgSetColumnFilter())
.allowedAggFuncs(AggregationFunction.avg, AggregationFunction.count)
.build();

ColDef nameColumn = ColDef.builder()
.field("name")
.sortable(false)
.filter(false)
.build();

QueryBuilder<Entity> queryBuilder = QueryBuilder.builder(Entity.class, entityManager)
.colDefs(priceColumn, nameColumn)
.build();