Custom pagination in the OutSystems Data Grid component is a server-side data loading approach used to efficiently handle large datasets. Instead of retrieving all records at once, the Data Grid requests only the subset of data required for the current page. This significantly improves performance, scalability, and user experience, especially in enterprise applications.
By default, loading large volumes of data into the client can cause slow screen rendering and high memory usage. Custom pagination solves this problem by delegating pagination logic to the server, while the Data Grid focuses on rendering and navigation.
When custom pagination is enabled, the Data Grid operates in On Demand mode. In this mode, the grid does not automatically fetch data. Instead, it triggers a request whenever the user navigates between pages, changes page size, or refreshes the grid.
The Data Grid internally calculates and provides:
StartIndex – the index of the first record required
PageSize – the number of records to load per page
These values are passed to server-side logic (usually an Advanced SQL query or Server Action) to retrieve only the relevant data slice.
On the server side, pagination is implemented using database-supported pagination mechanisms such as:
OFFSET / FETCH NEXT (SQL Server, PostgreSQL)
OFFSET / FETCH NEXT
ROW_NUMBER()–based pagination (Oracle, SQL Server older versions)
ROW_NUMBER()
The query returns only the records for the requested page, ordered consistently (for example, by CreatedDate or Id). This ensures stable and predictable paging behavior.
To support correct pagination controls (total pages, next/previous navigation), the Data Grid also requires the total number of records available in the dataset. This is typically retrieved using a separate COUNT(*) query that applies the same filters but does not include pagination.
The Data Grid component:
Handles pagination UI (page numbers, next/previous buttons)
Triggers data refresh requests
Displays the returned data
The developer is responsible for:
Implementing server-side pagination logic
Returning the correct page of data
Providing the total record count
Ensuring consistent sorting and filtering between data and count queries