VirtualServerModeSource Class
A data source that features event-based data operations: async data load, sorting, filtering and infinite scrolling through records (in a bound Windows Forms GridControl).
Namespace: DevExpress.Data
Assembly: DevExpress.Data.v18.2.dll
Declaration
[ToolboxBitmap(typeof(ResFinder), "Bitmaps256.VirtualServerModeSource.bmp")]
[ToolboxTabName("DX.18.2: Data & Analytics")]
public class VirtualServerModeSource :
Component,
IListSource,
ISupportInitialize
Remarks
The VirtualServerModeSource is an event-based data source for a Windows Forms Data Grid (GridControl). The events the data source provides allow you to asynchronously load data in batches, while taking into account a bound grid control’s sort and filter configuration.
A Data Grid bound to a VirtualServerModeSource supports infinite scrolling. On startup, the Data Grid fetches an initial batch of records from the data source. The control does not know the total number of records in the data source and thus, its scroll bar always reflects the current number of loaded rows. Once an end-user scrolls to the last loaded record, the grid requests an additional batch of records and adjusts its scroll bar to match the new loaded record count.
Note
Data grouping is not supported in a Data Grid control when it is bound to a VirtualServerModeSource.
The following are two main events the VirtualServerModeSource provides:
- 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.
Additional events allow you to control data shaping operations invoked in the bound grid control and enable CRUD operations:
- VirtualServerModeSource.GetUniqueValues - Allows you to provide values for columns’ filter dropdowns.
- VirtualServerModeSource.TotalSummary - Fires when a grid control asks the data source to calculate total summaries.
- VirtualServerModeSource.CanPerformColumnServerAction - Allows you to specify whether the requested filtering, sorting or summary calculation operation needs to be accepted or canceled.
- VirtualServerModeSource.AcquireInnerList -
This event can be handled to provide an inner list that will be storage for rows fetched using the VirtualServerModeSource’s events. To enable CRUD operations in a bound Data Grid, you need to provide an inner list that supports these operations. If no inner list is supplied (or you do not handle the AcquireInnerList event), CRUD operations are disabled in the grid control.
At design time, to create columns in a bound grid control for fields the VirtualServerModeSource provides, specify the VirtualServerModeSource.RowType property.
Demo: Infinite Scrolling module in the XtraGrid MainDemo