Skip to main content
All docs
V24.2

DxTreeListDataColumn.SortIndex Property

Specifies the column’s index among sorted columns. If the property is set to -1, TreeList data is not sorted by this column.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(-1)]
[Parameter]
public int SortIndex { get; set; }

Property Value

Type Default Description
Int32 -1

The column’s (zero-based) index among sorted columns. -1 if the TreeList does not sort data by this column.

Remarks

The SortIndex property allows you to sort TreeList data by an individual column in code. In this case, sorting is applied regardless of the DxTreeList.AllowSort or DxTreeListDataColumn.AllowSort property value.

If you sort data by multiple columns, this property specifies the sort level. For instance, the TreeList first sorts data by a column with SortIndex = 0 and then by a column with SortIndex = 1. If you set this property to -1, data is not sorted by the corresponding column.

@inject EmployeeTaskService EmployeeTaskService

<DxTreeList Data="TreeListData" KeyFieldName="Id" ParentKeyFieldName="ParentId">
    <Columns>
        <DxTreeListDataColumn FieldName="Name" Caption="Task" SortIndex="1" />
        <DxTreeListDataColumn FieldName="EmployeeName" />
        <DxTreeListDataColumn FieldName="StartDate" />
        <DxTreeListDataColumn FieldName="DueDate" 
                              SortIndex="0"
                              SortOrder="TreeListColumnSortOrder.Descending" />
    </Columns>
</DxTreeList>

@code {
    List<EmployeeTask> TreeListData { get; set; }

    protected override void OnInitialized() {
        TreeListData = EmployeeTaskService.GenerateData();
    }
}

TreeList - SortIndex

Run Demo: TreeList - Sort Data

For more information about data sorting in the TreeList component, refer to the following topic: Sort Data in Blazor TreeList.

Implements

See Also