Skip to main content

DxDataGridColumn.SortOrder Property

Specifies the column’s sort order.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v22.1.dll

Declaration

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

Property Value

Type Default Description
DataGridColumnSortOrder None

A DataGridColumnSortOrder enumeration value.

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

Important

The Data Grid was moved to maintenance support mode. No new features/capabilities will be added to this component. We recommend that you migrate to the Grid component.

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(Customer.City)"
                      SortOrder="DataGridColumnSortOrder.Ascending" 
                      SortIndex="0">
    </DxDataGridColumn>
    <DxDataGridColumn Field="@nameof(Customer.Country)"
                      SortOrder="DataGridColumnSortOrder.Ascending"
                      SortIndex="1">
    </DxDataGridColumn>
    @* ... *@
</DxDataGrid>

DataGrid Sort

Run Demo: Data Grid - Sort Data

See Also