Edit this page

Custom DataProvider

The DataProvider functionality of RadVirtualGrid exposes various mechanisms for extending the default behavior. This can be achieved by inheriting the DataProvider object and overriding its methods or properties.

Example 1: Defining a Custom DataProvider

public class CustomDataProvider: DataProvider
{
    public CustomDataProvider(IEnumerable source)
        :base(source)
    {

    }
}

Example 2: Applying the Custom DataProvider

this.VirtualGrid.DataProvider = 
            new CustomDataProvider(Club.GetClubs());

Figure 1: RadVirtualGrid with applied custom DataProvider

RadVirtualGrid with applied custom DataProvider

By inheriting the default DataProvider, the following methods and properties are exposed for customization.

Properties

  • InitialRowCount: If not overriden, gets the value that is set to the InitialRowCount property of RadVirtualGrid.

  • InitialColumnCount: If not overriden, gets the value that is set to the InitialRowCount property of RadVirtualGrid.

  • ShouldPushEditValueToGrid: When an editor is provided for the Editing operation, its edited value needs to be manually pushed to underlying source and to the grid through its PushCellValue method. If the ShouldPushEditValueToGrid property is overriden and returns a True value, updating the control with the edited property value will be done automatically.

  • DistinctValuesLimit: By default, its value is set to 1000. Through it, the maximum count of distinct values in the FilteringControl can be manipulated.

Methods

  • OnCellEditEnded: The method that is called when the CellEditEnded event is raised.

  • OnCellValueNeeded: The method that is called when the CellValueNeeded event is raised.

  • OnEditorNeeded: The method that is called when the EditorNeeded event is raised.

  • OnEditorValueChanged: The method that is called when the EditorValueChanged event is raised.

  • OnHeaderValueNeeded: The method that is called when the HeaderValueNeeded event is raised.

  • DistinctValuesLoading: Occurs when the grid column distinct values are about to be loaded.

  • FilterOperatorsLoading: The method is invoked when the FilterOperators for a given column are being loaded.

  • SortDescriptorPreparing: The method is called when the SortDescriptors are being prepared.

  • SortDescriptorPrepared: The method is called when the SortDescriptors are prepared and a sort operation will occur.

  • OnSortingCompleted: The method is called when the sort operation is completed.

  • FilterDescriptorPreparing: The method is called when the FilterDescriptors are being prepared.

  • FilterDescriptorPrepared: The method is called when the FilterDescriptors are prepared and a filter operation will occur.

  • OnFilteringCompleted: The method is called when the filter operation is completed.

  • ApplyFilterDescriptor: Adds the filter descriptor to the Source QCV, which is the collection used for the data operations of the provider.

  • ApplySortDescriptor: Adds the sort descriptor to the Source QCV, which is the collection used for the data operations of the provider.

  • RemoveColumnFilter: Removes the given filter descriptor from the Source QCV.

  • IsColumnReadOnly: Determines whether a given column is ReadOnly.

  • RemoveItemsFromSource: Removes a set of items from the underlying source.

See Also