Skip to main content
All docs
V25.1
  • DxTreeList.DeselectAllAsync() Method

    Deselects all rows in the TreeList.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    public Task DeselectAllAsync()

    Returns

    Type Description
    Task

    The task that is completed when all rows are deselected.

    Remarks

    The following methods allow you to manage TreeList selection:

    Call the DeselectAllAsync method to deselect all TreeList 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 TreeList, 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.

    @inject EmployeeTaskService EmployeeTaskService
    
    <DxTreeList @ref="TreeList"
                Data="TreeListData"
                KeyFieldName="Id"
                ParentKeyFieldName="ParentId"
                AllowSelectRowByClick="true"
                @bind-SelectedDataItems="@SelectedDataItems">
        <Columns>
            <DxTreeListDataColumn FieldName="Name" Caption="Task" />
            <DxTreeListDataColumn FieldName="EmployeeName" />
            <DxTreeListDataColumn FieldName="StartDate" />
            <DxTreeListDataColumn FieldName="DueDate" />
        </Columns>
    </DxTreeList>
    
    <DxButton Click="SelectAll">Select All Rows</DxButton>
    <DxButton Click="DeselectAll">Deselect All Rows</DxButton>
    
    @code {
        List<EmployeeTask> TreeListData { get; set; }
        IReadOnlyList<object> SelectedDataItems { get; set; }
        ITreeList TreeList { get; set; }
    
        protected override void OnInitialized() {
            TreeListData = EmployeeTaskService.GenerateData();
        }
        async Task SelectAll(MouseEventArgs args) {
            await TreeList.SelectAllAsync();
        }
        async Task DeselectAll(MouseEventArgs args) {
            await TreeList.DeselectAllAsync();
        }
    }
    

    Remote Data Source Limitations

    DevExpress Blazor TreeList has the following specifics and limitations when it is bound to the GridDevExtremeDataSource or loads data on demand:

    • Sort and filter operations cancel incomplete “select all” and “deselect all” processes.
    • The second call to the SelectAllAsync or DeselectAllAsync method cancels the operation initiated by the previously called method.
    • SelectAllAsync and DeselectAllAsync methods load all data to the TreeList and can reduce overall performance and increase memory consumption.

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

    See Also