Skip to main content

GridColumn.FieldNameSortGroup Property

Gets or sets another field by which data is sorted/grouped/filtered when sorting/grouping/filtering is applied to the current column. The FieldNameSortGroup property is intended to be used in Server data binding modes to sort columns (e.g., lookup columns) against text instead of edit values.

Namespace: DevExpress.XtraGrid.Columns

Assembly: DevExpress.XtraGrid.v24.1.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

[DefaultValue("")]
[DXCategory("Data")]
[XtraSerializableProperty]
public string FieldNameSortGroup { get; set; }

Property Value

Type Default Description
String String.Empty

A string that specifies a field name.

Remarks

Limitations

The FieldNameSortGroup property is intended to be used in Server data binding modes. Although the FieldNameSortGroup property may function correctly in some scenarios in regular binding mode, we do not recommend relying on the property in this mode. The suggested approach to perform custom sorting and grouping in regular binding mode is maintained by the following members: GridColumn.SortMode, ColumnView.CustomColumnSort and GridView.CustomColumnGroup.

Grouping

When you group by a column whose FieldNameSortGroup property is set to a certain field, the data groups are formed correctly if the following two potential data groupings produce the same data record set:

  1. grouping against the current column when the FieldNameSortGroup property is not set.
  2. grouping against the FieldNameSortGroup field

Otherwise, the grouping behavior is undefined.

Filtering

When opening a filter dropdown for a column, you can show another field’s values in this dropdown. To accomplish this, assign this field’s name to the FieldNameSortGroup property and set the OptionsColumnFilter.FilterBySortField option to True.

Example

In the example, the UnitPrice column is sorted. However, for this column the FieldNameSortGroup property is set to "ExtendedPrice". So, data is actually sorted by the ExtendedPrice field when the UnitPrice column is sorted.

The following image shows the result:

FieldNameSortGroup_ex

colUnitPrice.FieldNameSortGroup = "ExtendedPrice";
colUnitPrice.SortOrder = DevExpress.Data.ColumnSortOrder.Ascending;
See Also