Skip to main content

DataGridSelection<T> Class

Provides data for the OptimizedMultipleSelectionChanged event.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.2.dll

Declaration

public class DataGridSelection<T>

Type Parameters

Name Description
T

A data model type.

Remarks

Important

The Data Grid was moved to maintenance support mode. No new features/capabilities will be added to this component. We recommend that you migrate to the Grid component.

Handle the OptimizedMultipleSelectionChanged event to track selection changes in multiple selection mode with optimized performance.

<DxDataGrid Data="@DataSource"
    KeyFieldName="Id"
    SelectionMode="DataGridSelectionMode.OptimizedMultipleSelection"
    OptimizedMultipleSelectionChanged="OnSelectionChanged">
    ...
</DxDataGrid>

@code {
    int SelectedCount { get; set; }
    int StoredSelectedCount { get; set; }
    int StoredUnselectedCount { get; set; }

    protected void OnSelectionChanged(DataGridSelection<ProductFlat> selection) { 
        StoredSelectedCount = selection.SelectedKeysStored.Count();
        StoredUnselectedCount = selection.UnselectedKeysStored.Count();
        SelectedCount = selection.SelectedKeys.Count();
    }
}

Online Demo

Data Grid - Multiple Selection with Optimized Performance

Inheritance

Object
DataGridSelection<T>
See Also