Skip to main content
All docs
V24.2

DxTreeList.DeselectAllOnPage() Method

Deselects all rows on the currently visible page except for child rows of collapsed items.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public void DeselectAllOnPage()

Remarks

The following methods allow you to manage TreeList selection:

Call the DeselectAllOnPage method to remove all rows on the current page from selection. To add these rows to selection, call the SelectAllOnPage method. Note that these methods do not affect child rows of collapsed items.

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

<style>
    .my-button {
        width: 200px;
    }
</style>

<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="() => TreeList.SelectAllOnPage()" CssClass="my-button" Text="Select All on Page"/>
<DxButton Click="() => TreeList.DeselectAllOnPage()" CssClass="my-button" Text="Deselect All on Page" />

@code {
    List<EmployeeTask> TreeListData { get; set; }
    IReadOnlyList<object> SelectedDataItems { get; set; }
    ITreeList TreeList { get; set; }

    protected override void OnInitialized() {
        TreeListData = EmployeeTaskService.GenerateData();
    }
}

Blazor TreeList Select and Deselect All On Page

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

See Also