DxDataGridColumn.SortOrder Property

Specifies the column’s sort order.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.1.dll

Declaration

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

Property Value

Type Default Description
DataGridColumnSortOrder

None

One of the enumeration values.

Available values:

Name Description
None

No sorting is applied to a column.

Ascending

Sorts the column in ascending order.

Descending

Sorts the columns in descending order.

Remarks

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

NOTE

If you do not specify these properties, the Data Grid is sorted by a data source field that is marked with the Key attribute. If the data source does not contain a key field, component data is not sorted.

<DxDataGrid Data="@DataSource">
    <DxDataGridColumn Field="@nameof(ProductFlat.Category)"
                      SortOrder="DataGridColumnSortOrder.Descending" 
                      SortIndex="0">
    </DxDataGridColumn>
    <DxDataGridColumn Field="@nameof(ProductFlat.Subcategory)"
                      SortOrder="DataGridColumnSortOrder.Ascending"
                      SortIndex="1">
    </DxDataGridColumn>
    ...
</DxDataGrid>

DataGrid Sort

Online Demo

Data Grid - Sort Data

See Also