Skip to main content
All docs
V25.1
  • DxTreeListDataColumn.SortOrder Property

    Specifies the column’s sort order (ascending or descending).

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    [DefaultValue(TreeListColumnSortOrder.None)]
    [Parameter]
    public TreeListColumnSortOrder SortOrder { get; set; }

    Property Value

    Type Default Description
    TreeListColumnSortOrder None

    An enumeration value.

    Available values:

    Name Description
    None

    The TreeList sorts column data in ascending order.

    Ascending

    The TreeList sorts column data in ascending order.

    Descending

    The TreeList sorts column data in descending order.

    Remarks

    When you specify a column’s SortIndex property, the TreeList sorts column data in ascending order. Use the SortOrder property to change the sort order.

    The following example sorts TreeList data by the Due Date column in descending order, and then sorts data by the Name column in ascending order:

    @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