Skip to main content
A newer version of this page is available. .

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.v18.2.dll

Declaration

[DXCategory("Data")]
[DefaultValue("")]
[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;

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the FieldNameSortGroup property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also