Server-side Row Model
This section gives an overview of the Server-side Row Model and provides guidance on when it should be used.
The Server-side Row Model allows applications to work with very large datasets by delegating grid operations such as grouping, sorting and pivoting to the server. The data is then lazy loaded from the server in blocks as the user browses through the data. This is demonstrated below:
Before diving into the details of how to use the Server-side Row Model, the next section provides an overview and explains when it should be used in instead of the default Client-side Row Model.
When designing a grid based application, one of the key considerations is how much data needs to be sent from the server to the client. The answer to this determines which Row Model should be selected for the grid.
Client-side Row Model
The simplest approach is to send all row data to the browser in response to a single request at initialisation. For this use case the Client-side Row Model has been designed.
This scenario is illustrated below where 10,000 records are loaded directly into the browser:
Once the data is loaded into the grid using the Client-side Row Model, the grid can then do sorting, filtering, grouping etc on the data inside the grid without requiring further assistance from the application.
The Client-side Row Model only renders the rows currently visible using DOM Virtualisation, so the upper limit of rows is governed by the browsers memory footprint and data transfer time, rather than any restrictions inside the grid.
Server-side Row Model
However many real world applications contain much larger data sets, often involving millions of records. In this case it simply isn't feasible to load all the data into the browser in one go. Instead data will somehow need to be lazy-loaded as required and then purged to limit the memory footprint in the browser.
This is precisely the problem the Server-side Row Model addresses, along with delegating server-side operations such as filtering, sorting, grouping and pivoting.
The following diagram shows the approach used by the Server-side Row Model. Here there are 10 million records, however the number of records is only constrained by the limits of the server-side:
As the user performs operations such as sorting and grouping, the grid issues requests to the server that contains all the necessary metadata required, including which portion of data should be returned based on the users position in the data set.
The browser will never run out of heap space as the grid will automatically purge out-of-range records.
You may benefit from the combination of all these features or just be interested in a subset. The features of the Server-side Row Model are:
- Lazy Loading of Groups: The grid will load the top level rows only. Children of groups are only loaded when the user expands the group. Some applications may use the Server-side Row Model for this one feature alone e.g. you might have a managers database table, you can display a list of all managers, then click 'expand' on the manager and the grid will then request to get the 'employees' for that manager.
- Server-side Grouping, Pivot and Aggregation: Because the data is coming back from the server one group level at a time, this allows you to do aggregation on the server, returning back the aggregated results for the top level parent rows. For example you could include 'employee count' as an attribute on the returned manager record, to say how many employees a manager manages.
- Infinite Scrolling: Rows are read back from the server in blocks to provide the experience of infinite scrolling. This happens at each grouping level (ie the top level rows are brought back in blocks, then when you expand a group, the children of that group are also loaded in blocks). This allows viewing very large datasets in the browser by only bringing back data one block at a time. This feature reuses the logic from the Infinite Scrolling row model, so understanding how that row model works will help you in understanding this part of the Server-side Row Model.
Full Stack Examples
All the examples in this documentation are standalone examples that can be run inside the documentation and exported to Plunker. This is excellent as you can easily inspect fully working examples. To allow this, all the examples have mocked servers (as the examples in the docs and Plunker are client side only).
To accompany the examples in the documentation, we also provide the following full stack examples for reference. We advise using the examples in the documentation to learn about the Server-side Row Model and then using the full stack examples as reference.
The full stack examples are as follows:
- Node.js connecting to MySQL
- Java Server connecting to Oracle
- GraphQL connecting to MySQL
- Java Server connecting to Apache Spark
To get started using the Server-side Row Model see the next section on: Server-side Datasource.