DxTreeList.IsRowExpanded(Int32) Method
Returns whether the row with the specified visible index is expanded.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
#Declaration
public bool IsRowExpanded(
int visibleIndex
)
#Parameters
Name | Type | Description |
---|---|---|
visible |
Int32 | A row’s visible index. |
#Returns
Type | Description |
---|---|
Boolean |
|
#Remarks
Call the ExpandAll or CollapseAll method to expand or collapse all rows in the TreeList component. Pass a row’s visible index to the ExpandRow or CollapseRow method to expand or collapse the row. The IsRowExpanded
method returns whether a row with the specified visible index is expanded.
Note
When the TreeIs
method to ensure that the specified data row is loaded.
Enable the AutoExpandAllNodes property to automatically expand TreeList rows when the TreeList loads data.
#Example
The following code example allows users to click rows to expand and collapse them:
@inject SpaceObjectDataProvider SpaceObjectDataProvider
<DxTreeList @ref="TreeList" Data="TreeListData" ChildrenFieldName="Satellites" RowClick="OnRowClick">
<Columns>
<DxTreeListDataColumn FieldName="Name" />
<DxTreeListDataColumn FieldName="TypeOfObject" Caption="Type" />
<DxTreeListDataColumn FieldName="Mass10pow21kg" Caption="Mass, kg" DisplayFormat="N2">
<HeaderCaptionTemplate>Mass, 10<sup>21</sup> × kg</HeaderCaptionTemplate>
</DxTreeListDataColumn>
<DxTreeListDataColumn FieldName="MeanRadiusInKM" Caption="Radius, km" DisplayFormat="N2"/>
<DxTreeListDataColumn FieldName="Volume10pow9KM3" DisplayFormat="N2">
<HeaderCaptionTemplate>Volume, 10<sup>9</sup> × km<sup>3</sup></HeaderCaptionTemplate>
</DxTreeListDataColumn>
<DxTreeListDataColumn FieldName="SurfaceGravity" DisplayFormat="N2">
<HeaderCaptionTemplate>Gravity, m/s<sup>2</sup></HeaderCaptionTemplate>
</DxTreeListDataColumn>
</Columns>
</DxTreeList>
@code {
ITreeList TreeList { get; set; }
object TreeListData { get; set; }
protected override async Task OnInitializedAsync() {
TreeListData = SpaceObjectDataProvider.GenerateData();
}
void OnRowClick(TreeListRowClickEventArgs e) {
if (TreeList.IsRowExpanded(e.VisibleIndex))
TreeList.CollapseRow(e.VisibleIndex);
else
TreeList.ExpandRow(e.VisibleIndex);
}
}