Skip to main content
All docs
V25.1
  • DxTreeListColumn.VisibleIndexChanged Event

    Fires when the column’s visible index changes.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    [Parameter]
    public EventCallback<int> VisibleIndexChanged { get; set; }

    Parameters

    Type Description
    Int32

    A new VisibleIndex property value.

    Remarks

    The VisibleIndex property allows you to define display order for TreeList columns explicitly. Users can then reorder columns at runtime. Handle the VisibleIndexChanged event to respond to column position changes.

    @inject EmployeeTaskService EmployeeTaskService
    
    <DxTreeList Data="TreeListData" KeyFieldName="Id" ParentKeyFieldName="ParentId">
        <Columns>
            <DxTreeListDataColumn FieldName="Name" Caption="Task" VisibleIndex="@CurrentIndex"
                                  VisibleIndexChanged="OnVisibleIndexChanged" />
            <DxTreeListDataColumn FieldName="EmployeeName"  />
            <DxTreeListDataColumn FieldName="StartDate" />
            <DxTreeListDataColumn FieldName="DueDate" />
        </Columns>
    </DxTreeList>
    
    <div>@IndexInfo</div>
    
    @code {
        int CurrentIndex { get; set; }
        string IndexInfo { get; set; }
        List<EmployeeTask> TreeListData { get; set; }
    
        protected override void OnInitialized() {
            TreeListData = EmployeeTaskService.GenerateData();
        }
        void OnVisibleIndexChanged(int newIndex) {
            CurrentIndex = newIndex;
            IndexInfo = "You moved the 'Task' column to position " + (newIndex + 1);
        }
    }
    

    Blazor TreeList Column Visible Index Changed

    Set the DxTreeList.AllowColumnReorder or DxTreeListColumn.AllowReorder property to false to prevent users from reordering columns.

    See Also