DxTreeList.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’s visible index. |
| fieldName | String | A column field name. |
Remarks
The TreeList 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.
Note
When the TreeList is bound to the GridDevExtremeDataSource or loads data on demand, call the WaitForRemoteSourceRowLoadAsync(Int32) method before you execute the MakeCellVisible 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.
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 TreeList horizontally/vertically until the cell appears.
The following code snippet displays buttons that navigate to the first/last data cells:
@inject EmployeeTaskService EmployeeTaskService
<DxTreeList @ref="TreeList"
Data="TreeListData"
KeyFieldName="Id"
AutoExpandAllNodes="true"
ParentKeyFieldName="ParentId"
VirtualScrollingEnabled="true"
CssClass="my-class">
<Columns>
<DxTreeListDataColumn FieldName="Name" Caption="Task" Width="300px" />
<DxTreeListDataColumn FieldName="EmployeeName" Width="200px" />
<DxTreeListDataColumn FieldName="StartDate" Width="150px" />
<DxTreeListDataColumn FieldName="DueDate" Width="150px" />
</Columns>
<ToolbarTemplate>
<DxToolbar>
<DxToolbarItem Text="First Cell" Click="@(() => TreeList.MakeCellVisible(0, "Name"))" />
<DxToolbarItem Text="Last Cell"
Click="@(() => TreeList.MakeCellVisible(TreeList.GetVisibleRowCount()-1, "DueDate"))" />
</DxToolbar>
</ToolbarTemplate>
</DxTreeList>
@code {
ITreeList TreeList;
List<EmployeeTask> TreeListData { get; set; }
protected override void OnInitialized() {
TreeListData = EmployeeTaskService.GenerateData();
}
}