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();

Dot notation

The adapter fully supports querying nested fields using standard dot notation (e.g., "category.name" or "user.address.city").

JPA Requirement

For dot notation to work, the referenced path must correspond to a mapped relationship (e.g., @ManyToOne, @OneToOne) within your JPA Entity.

Suppress Field Dot Notation - Flat data

By default, dot notation fields are returned as nested JSON objects to align with AG Grid's default behavior.

To return flat keys (e.g., "category.name": "Value"), you must enable suppressFieldDotNotation in the QueryBuilder.

QueryBuilder<Entity> queryBuilder = QueryBuilder.builder(Entity.class, entityManager)
.colDefs(
// ...col defs
)
.suppressFieldDotNotation(true)
.build();
Client-Side Configuration

If you enable suppressFieldDotNotation(true) in the backend, you must also set suppressFieldDotNotation to true in your AG Grid options on the frontend to ensure the grid treats dots as literal characters.