LyteNyte Grid logo for light mode. Links back to the documentation home page.
Server Data Loading

Server Row Grouping

Display hierarchical data by using the server data source to request and assemble data slices for grouped views.

Server Grouped Rows

To group rows in the server data source, define a custom row group model. The simplest approach uses an array of string values, where each value is the ID of a column to group by. Send this model to the server to request grouped rows.

The example below shows this behavior. For details on the data request interface used by the server data source, see the Data Interface guide.

Basic Server Row Grouping

Row Groups
Education Level
Gender
Age
YoE
Fork code on stack blitzFork code on code sandbox

This basic grouping example excludes aggregations, so only leaf-level rows contain data values.

The demo’s server.ts file shows the parent/child logic required to build and return grouped rows. Compared to flat rows, grouped rows add parent/child structure to the data model. To support this hierarchy, the grid includes a path property in each request to identify the specific group being fetched.

Return the same path in the response so the server data source can store the returned rows in its internal data tree.

Server Row Aggregations

To display values on group rows, return group rows with aggregated data from the server. In the demo, click the aggregation name in a column header to change the aggregation. Each change updates the queryKey, which refreshes the server data source and updates the view with new values.

Aggregated Server Row Grouping

Row Groups
Education Level
Gender
Age
YoE
Fork code on stack blitzFork code on code sandbox

Not every column requires aggregation, especially text columns. The server must return correct aggregate values, as LyteNyte Grid does not validate them and simply trusts the server’s response.

Many aggregation types are supported. In most cases, these correspond to the aggregation functions available in your database. Common examples include sum and average, while advanced databases like ClickHouse provide additional functions listed here.

Displaying Child Counts

When grouping rows, it is sometimes useful to display the direct child count on each parent row. This helps visualize the size of each group.

To support this, the server can include a child count value for each group in the response data. The demo below illustrates this by showing child counts in the group cells.

Row Grouping with Child Counts

Row Groups
Education Level
Gender
Age
YoE
Fork code on stack blitzFork code on code sandbox

Note

Include child counts directly in the row data to make them accessible to cell renderers. The child count property on the group row response belongs to the server data loading interface, not the row interface.

Next Steps