Skip to main content
All docs
V24.2

DxTreeList.ExpandAll() Method

Expands all rows in the TreeList component.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public void ExpandAll()

Remarks

Call the ExpandAll or CollapseAll method to expand or collapse all rows in the TreeList component. To expand or collapse a specific row, pass the row’s visible index to the ExpandRow or CollapseRow method. The IsRowExpanded(Int32) method returns whether a row with the specified visible index is expanded.

Enable the AutoExpandAllNodes property to automatically expand TreeList rows when the TreeList loads data.

Limitations

The TreeList component does not support ExpandAll and CollapseAll() methods when it bound to server-mode data or loads data on demand.

Example

The following example displays Expand All and Collapse All buttons in the TreeList toolbar:

@inject SpaceObjectDataProvider SpaceObjectDataProvider

<DxTreeList @ref="TreeList" Data="TreeListData" ChildrenFieldName="Satellites">
    <Columns>
        <DxTreeListDataColumn FieldName="Name" />
        <DxTreeListDataColumn FieldName="TypeOfObject" Caption="Type" />
        <DxTreeListDataColumn FieldName="Mass10pow21kg" Caption="Mass, kg" DisplayFormat="N2">
            <HeaderCaptionTemplate>Mass, 10<sup>21</sup> &#215; kg</HeaderCaptionTemplate>
        </DxTreeListDataColumn>
        <DxTreeListDataColumn FieldName="MeanRadiusInKM" Caption="Radius, km" DisplayFormat="N2"/>
        <DxTreeListDataColumn FieldName="Volume10pow9KM3" DisplayFormat="N2">
            <HeaderCaptionTemplate>Volume, 10<sup>9</sup> &#215; km<sup>3</sup></HeaderCaptionTemplate>
        </DxTreeListDataColumn>
        <DxTreeListDataColumn FieldName="SurfaceGravity" DisplayFormat="N2">
            <HeaderCaptionTemplate>Gravity, m/s<sup>2</sup></HeaderCaptionTemplate>
        </DxTreeListDataColumn>
    </Columns>
    <ToolbarTemplate>
        <DxToolbar>
            <Items>
                <DxToolbarItem Text="Expand All" Click="() => TreeList.ExpandAll()" />
                <DxToolbarItem Text="Collapse All" Click="() => TreeList.CollapseAll()" />
            </Items>
        </DxToolbar>
    </ToolbarTemplate>
</DxTreeList>

@code {
    ITreeList TreeList { get; set; }
    object TreeListData { get; set; }

    protected override async Task OnInitializedAsync() {
        TreeListData = SpaceObjectDataProvider.GenerateData();
    }
}

Blazor TreeList Exapand All

Implements

See Also