AG Grid
AG Grid's Server-Side Row Model (SSRM) sends a structured JSON request — paging window,
filter model, sort model, row-group columns — and expects rows plus a row count back.
FlexQuery.NET.Adapters.AgGrid translates that contract onto QueryOptions in one
direction and the QueryResult back into the SSRM payload in the other, so a grid speaks
directly to your database through the full FlexQuery pipeline.
What the adapter maps
| AG Grid concept | FlexQuery target |
|---|---|
startRow / endRow | Paging window |
filterModel (set, number, text, date, join operators) | Filter conditions/groups |
sortModel | Sort nodes |
rowGroupCols + groupKeys | groupBy + group filters |
valueCols | Aggregates |
Convert the request
using FlexQuery.NET.Adapters.AgGrid;
using FlexQuery.NET.Adapters.AgGrid.Models;
[HttpPost("api/ef/aggrid/customers")]
public async Task<IActionResult> GetRows(
[FromBody] AgGridRequest request,
CancellationToken ct)
{
var options = request.ToQueryOptions();
var result = await db.Customers
.FlexQueryAsync(options, cancellationToken: ct);
return Ok(result.ToAgGridServerSideResponse(request));
}ToQueryOptions() maps the entire request model; ToAgGridServerSideResponse produces
the SSRM payload (rowData + rowCount, group rows carrying their child-key metadata so
drill-down works). Overloads accept an explicit camelCase flag and
AgGridResponseFieldOptions for renaming the group metadata fields (group, field,
level, leafGroup, childCount, �).
Applying onto existing options
When you have endpoint defaults the grid should not override:
var options = new QueryOptions { /* your defaults */ };
options.ApplyAgGridRequest(agGridRequest); // merges the grid request in placeParsing raw JSON
For minimal APIs or controllers that read the body as JsonElement:
var options = jsonElement.ToQueryOptions();Complete worked example
A row-grouped revenue grid — grouping and aggregates flow from the grid's column config:
[HttpPost("api/ef/aggrid/orders")]
public async Task<IActionResult> GetOrderRows(
[FromBody] AgGridRequest request,
CancellationToken ct)
{
var options = request.ToQueryOptions();
// e.g. request.rowGroupCols = [Status], request.valueCols = [{ field: Total, agg: sum }]
// -> groupBy=Status, aggregate=sum:Total
var result = await db.Orders
.FlexQueryAsync(options, cancellationToken: ct);
return Ok(result.ToAgGridServerSideResponse(request));
}The grid's group drill-down sends the same request shape with groupKeys populated; the
adapter turns those into group-key filters, and FlexQuery pages the matching rows.