DxGrid.GetRowLevel(Int32) Method
Gets the nesting level of the processed row.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
public int GetRowLevel(
int visibleIndex
)
Parameters
Name | Type | Description |
---|---|---|
visibleIndex | Int32 | The row’s visible index. |
Returns
Type | Description |
---|---|
Int32 | The row’s nesting level. |
Remarks
The nesting level determines the number of group rows a user should expand to reach the processed row from the root. The root row’s level is 0
, the level of its children is 1
, and so on.
Note
The Grid bound to an Instant Feedback Data Source or GridDevExtremeDataSource loads data asynchronously in small portions (instead of the entire dataset). Before you call the GetRowLevel
method, call the WaitForRemoteSourceRowLoadAsync(Int32) method to ensure that the specified data row is loaded.
The following code snippet gets the level of the row whose visible index is 2.
@using Grid.Data
@inject WeatherForecastService ForecastService
<DxGrid Data="Data"
ShowGroupPanel="true"
@ref="MyGrid">
<Columns>
<DxGridDataColumn FieldName="Date"
DisplayFormat="D" />
<DxGridDataColumn FieldName="TemperatureC"
GroupIndex="0" />
<DxGridDataColumn FieldName="TemperatureF" />
<DxGridDataColumn FieldName="Forecast" />
<DxGridDataColumn FieldName="CloudCover"
GroupIndex="1" />
</Columns>
</DxGrid>
<p />
<DxButton Click="OnGetRowLevel">Get the level of row 2</DxButton>
<p />
@Alert
@code {
IGrid MyGrid { get; set; }
object Data { get; set; }
string Alert { get; set; }
protected override void OnInitialized() {
Data = ForecastService.GetForecast();
}
void OnGetRowLevel() {
Alert = $"The level of row 2 is {MyGrid.GetRowLevel(2)}";
}
}