Infinite Scrolling
- 2 minutes to read
For large recordsets or when the exact record count cannot be determined in advance, you can supply data to the Data Grid in batches, continuously providing more records once an end-user approaches the bottom of the grid. In this case, the Data Grid functions in infinite scrolling mode, in which the scrollbar reflects the currently loaded amount of records. When new records are supplied, the scroll bar re-adjusts its size. This mode successfully replaces data pagination used in data-aware controls from other vendors.
To provide data in batches (asynchronously or synchronously) and enable infinite scrolling in the Data Grid, bind the control to a VirtualServerModeSource and handle events the data source provides to supply data and perform requested data operations. The following are two main events you may need to handle:
- VirtualServerModeSource.ConfigurationChanged -
Fires on initial data load and reload in the bound grid control, and when the data grid’s sort and filter configuration changes. Allows you to initialize the data source and (optionally) return an initial batch of records.
- VirtualServerModeSource.MoreRows - Fires when a bound grid control asks the data source for a new batch of rows.
Data editing is disabled by default. To learn how to enable it, see VirtualServerModeSource.AcquireInnerList.
Note
Grid Control does not support data grouping when it’s bound to a VirtualServerModeSource.
TileView does not support Infinite Scrolling in Kanban mode.
For more information, see VirtualServerModeSource.
Demo: Infinite Scrolling module in the XtraGrid MainDemo
Knowledge Base article: Grid Control - How to implement the pagination functionality.