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, due to the way that Column Filters are created in AdapTable - using Predicates - 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 rows to mimic multiple rows on our 'Mock Server' - which implements getRows.
- We pass that Mock Server to ag-Grid via its api method setServerSideDatasource - this calls getRows (see above) whenever the filters change or user scrolls to bottom of grid.
- We set the Batch Count to 100 so that 100 rows are loaded at at time - when you scroll and reach 100 you will see a small lag.
- On our mock server, we call a getTradesRange function each time that getRows is invoked by ag-Grid, passing in the current row count information.
- We pass the current AdaptableSearchState which includes the Column Filters, allowing us to perform on the server the same filtering 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 retrieive the distinct values for each column too show in the filter dropdown...
- ...And we set the name of this function in the PermittedValuesItems property of the UserInterace section of Predefined Config.