Server Row Model Demo

ag-Grid has an incredibly powerful and useful Server Row Model which allows you to populate your grid via your server as the user scrolls - ideal for enormous datasets.

(There is also an Infinite Scrolling Model which performs similarly but it is has less functionality than Server Row Model and is less frequently used.)

Unlike with the - default - Client-Side Row Model ag-Grid will not perform any filtering or sorting, and these must be done by the developer on the server.

Likewise AdapTable cannot perform its out of the box searching, filtering or sorting in this mode (though Quick Search does work as it highlights cells and doesn't filter).

However, thanks to the way that the Search and Sort states are abstracted in AdapTable, its relatively easy to hand this off to the server to perform.

In this demo we provide an example - its slightly contrived as we want to display all the code required on a single page - but note the following features:

  • We create 200,000 date entries on our 'Fake Server' - which simulates a real life server.
  • We create a ServerSideDatasource which implements getRows (see IServerSideDatasource)
  • We pass that datasource to ag-Grid via its api method setServerSideDatasource - this calls getRows (see above) whenever the filters change or user scrolls to bottom of grid.
  • In our datasource, we call a fetchServerData function each time that getRows is invoked by ag-Grid, passing in the current row count information.
  • We also pass the current AdaptableSearchState which includes the ColumnFilters & Query(AST or string), allowing us to perform on the server the same filtering & searching as AdapTable does for us on the client.
  • We also pass the current AdaptableSortState which includes which columns are sorted and the sort direction, and we perform the same sorting on our result set.
  • We use the GetColumnValuesFunction in UserFunctions to retrieve the distinct values for each column to show in the filter dropdown...
  • ...And we set the name of this function in the PermittedValuesItems property of the UserInterace section of Predefined Config.
AdapTable Help Resources:

Generating dummy data, please wait ...