Skip to main content

DxDataGridColumn.AllowSort Property

Specifies whether users can sort data by the column’s values.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v22.1.dll

Declaration

[DefaultValue(null)]
[Parameter]
public bool? AllowSort { get; set; }

Property Value

Type Default Description
Nullable<Boolean> null

true if users can sort data by the column’s values; otherwise, false.

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.

Users can click a column header to sort grid data by this column. To change the sort order, users should click the column header once again. To sort grid data by multiple columns, users should click column headers with the Shift key pressed.

DataGrid Sort

A column’s AllowSort property allows you to enable/disable sorting data by individual columns. If this property is set to NULL, the data grid’s AllowSort property defines the column’s behavior.

The following example demonstrates how to disable sorting by the Contact Name column (set the column’s AllowSort property to false).

<DxDataGrid Data="@DataSource">
    <DxDataGridColumn Field="@nameof(Customer.ContactName)" AllowSort="false" >
    </DxDataGridColumn>
    ...
</DxDataGrid>

The following example demonstrates how to disable sorting in the entire grid (set the data grid’s AllowSort property to false) but enable sorting by the Contact Name column (set the column’s AllowSort property to true).

<DxDataGrid Data="@DataSource" AllowSort="false">
    <DxDataGridColumn Field="@nameof(Customer.ContactName)" AllowSort="true">
    </DxDataGridColumn>
    @* ... *@
</DxDataGrid>

Note

You can use the column’s SortIndex property to sort data in code regardless of the AllowSort property value.

Run Demo: Data Grid - Sort Data

See Also