Back to Devexpress

DxGrid.DeselectAllAsync() Method

blazor-devexpress-dot-blazor-dot-dxgrid-7a4ea336.md

latest5.1 KB
Original Source

DxGrid.DeselectAllAsync() Method

Deselects all rows in the grid.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
public Task DeselectAllAsync()

Returns

TypeDescription
Task

The task that is completed when all rows are deselected.

|

Remarks

The following methods allow you to manage Grid selection:

Call the DeselectAllAsync method to deselect all grid rows currently available for user interaction.

This method does not affect the selection state of the rows hidden by a filter. To deselect every row in the grid, call the ClearSelection method.

To access data items that correspond to selected rows, implement two-way binding for the SelectedDataItems property or handle the SelectedDataItemsChanged event.

razor
<DxGrid Data="@Products" @ref="Grid" KeyFieldName="ProductId" 
        AllowSelectRowByClick="true" @bind-SelectedDataItems="@SelectedDataItems">
    <Columns>
        <DxGridDataColumn FieldName="ProductName" />
        <DxGridDataColumn FieldName="Category"/>
        <DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c" />
        <DxGridDataColumn FieldName="UnitsInStock" />
    </Columns>
</DxGrid>
<DxButton Click="SelectAll">Select All Rows</DxButton>
<DxButton Click="DeselectAll">Deselect All Rows</DxButton>

@code {
    IEnumerable<Product> Products { get; set; }
    IReadOnlyList<object> SelectedDataItems { get; set; }
    IGrid Grid { get; set; }

    protected override async Task OnInitializedAsync() {
        Products = await NwindDataService.GetProductsAsync();
    }
    async Task SelectAll(MouseEventArgs args) {
        await Grid.SelectAllAsync();
    }
    async Task DeselectAll(MouseEventArgs args) {
        await Grid.DeselectAllAsync();
    }
}

Run Demo: Data Grid - Selection API

Large Data Limitation

For additional information about selection in the Grid component, refer to the following topic: Selection and Focus in Blazor Grid.

Implements

DeselectAllAsync()

See Also

DxGrid Class

DxGrid Members

DevExpress.Blazor Namespace