Skip to main content
All docs
V26.1
  • TreeListFocusedRowChangedEventArgs.VisibleIndex Property

    Returns the visible index of the focused row.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.Grid.v26.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    public int VisibleIndex { get; }

    Property Value

    Type Description
    Int32

    If a data row is focused, the property returns this row’s visible index. The property returns -1 if a new row is focused or the TreeList displays no rows.

    Remarks

    Row Indexes

    The TreeList component assigns indexes to visible nodes to indicate row order. Indexes are zero-based and sequential across all TreeList pages.

    Row Indexes - All Pages

    DxTreeList reassigns row indexes each time a user sorts or filters data and expands/collapses rows. Filtered-out rows and rows within collapsed nodes do not have indexes. In the following image, the TreeList component does not assign indexes to subtasks of the Create Action Plan… task.

    Visible Indexes - Collapsed Items

    Example

    The following example displays the focused row’s visible index:

    @inject EmployeeTaskService EmployeeTaskService
    
    <DxTreeList Data="TreeListData"
                KeyFieldName="Id"
                ParentKeyFieldName="ParentId"
                FocusedRowEnabled="true"
                FocusedRowChanged="e => rowNumber = e.VisibleIndex + 1">
        <Columns>
            <DxTreeListDataColumn FieldName="Name" Caption="Task" />
            <DxTreeListDataColumn FieldName="EmployeeName" />
            <DxTreeListDataColumn FieldName="StartDate" />
            <DxTreeListDataColumn FieldName="DueDate" />
        </Columns>
    </DxTreeList>
    <text>The focused row number is @rowNumber</text>
    @code {
        List<EmployeeTask> TreeListData { get; set; }
        int rowNumber { get; set; }
    
        protected override void OnInitialized() {
            TreeListData = EmployeeTaskService.GenerateData();
        }
    }
    

    Refer to the TreeListFocusedRowChangedEventArgs class description for additional information.

    See Also