DxGrid.MakeCellVisible(Int32, String) Method
Navigates to the cell displayed at the intersection of the specified row and data column.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v25.2.dll
Declaration
public void MakeCellVisible(
int visibleIndex,
string fieldName
)
Parameters
| Name | Type | Description |
|---|---|---|
| visibleIndex | Int32 | A row visible index. |
| fieldName | String | A column field name. |
Remarks
The Grid uniquely identifies each data cell by its row and column. To navigate to a data cell, pass the data row’s visible index and column field name to the MakeCellVisible method. To navigate to a group cell, pass the group row’s visible index and any field name to this method.
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 MakeCellVisible method, call the WaitForRemoteSourceRowLoadAsync(Int32) method to ensure that the specified data row is loaded.
The MakeCellVisible method does nothing in the following cases:
- The passed visible index is invalid (less than
0or greater than the total number of visible rows). - No visible column corresponds to the passed field.
- Grid data is grouped by the corresponding column and ShowGroupedColumns is
false(default).
When parameters are valid, the MakeCellVisible method performs the following actions:
- If the row is on another page, navigates to that page and updates the PageIndex property.
- Scrolls the Grid horizontally/vertically until the cell appears.
The following code snippet displays buttons that navigate to the first/last data cells:
@inject WeatherForecastService ForecastService
<DxGrid Data="@Data" @ref="MyGrid">
<Columns>
<DxGridDataColumn FieldName="Date" DisplayFormat="D" />
<DxGridDataColumn FieldName="TemperatureC" Caption="@("Temp. (\x2103)")" Width="120px" />
<DxGridDataColumn FieldName="TemperatureF" Caption="@("Temp. (\x2109)")" Width="120px" />
<DxGridDataColumn FieldName="Forecast" />
<DxGridDataColumn FieldName="CloudCover" />
</Columns>
<ToolbarTemplate>
<DxToolbar>
<DxToolbarItem Text="First Cell" Click="@(() => MyGrid.MakeCellVisible(0, "Date"))" />
<DxToolbarItem Text="Last Cell"
Click="@(() => MyGrid.MakeCellVisible(MyGrid.GetVisibleRowCount()-1, "CloudCover"))" />
</DxToolbar>
</ToolbarTemplate>
</DxGrid>
@code {
IGrid MyGrid { get; set; }
IEnumerable<WeatherForecast> Data { get; set; }
protected override void OnInitialized() {
Data = ForecastService.GetForecast();
}
}