Reputation: 9839
In a DexEpress ASPxGridView I have a column that contains voltage. The original values look like 200, 1000, 120 but I am applying a scaling that transforms the values into 200 V, 1 kV and 120 V.
How do I sort the column based on the original values and not the string values?
(In a .Net datagrid I had 2 columns: one with the original data (hidden) and one with the transformed data and I used the original data column to sort the rows. Is there something similar here?)
Upvotes: 1
Views: 6158
Reputation: 3214
I had a problem with sorting. I sorted a column by using
this.gvRuleDetail.SortInfo.AddRange(new DevExpress.XtraGrid.Columns.GridColumnSortInfo[] {
new DevExpress.XtraGrid.Columns.GridColumnSortInfo(this.gcRuleOrder, DevExpress.Data.ColumnSortOrder.Ascending)});
but then I realized that column shown sorted but actual data I mean first loaded data is not sorted. To solve this you also have to update first data:
this.gvRuleDetail.BeginSort();
this.gvRuleDetail.SortInfo.AddRange(new DevExpress.XtraGrid.Columns.GridColumnSortInfo[] {
new DevExpress.XtraGrid.Columns.GridColumnSortInfo(this.gcRuleOrder, DevExpress.Data.ColumnSortOrder.Ascending)});
this.gvRuleDetail.EndSort();
for devexpress problems, I recommend devexpress documentation here
Upvotes: 0
Reputation: 11376
Set the column's Settings.SortMode to the Value property. This should force the grid sort value in this column the way you need it.
Upvotes: 1