實踐發覺總是排序不了,經過不斷摸索發覺,要設置一下該欄的SortMode屬性為Value。
//
// module
//
resources.ApplyResources(this.module, "module");
this.module.ColumnEdit = this.repositoryItemLookUpEdit1;
this.module.FieldName = "module";
this.module.Name = "module";
this.module.OptionsColumn.ReadOnly = true;
this.module.SortMode = DevExpress.XtraGrid.ColumnSortMode.Value;
-------------------------------------------------
gridView1.Columns["module"].SortIndex = 0;
gridView1.Columns["module"].SortOrder = DevExpress.Data.ColumnSortOrder.Ascending;
gridView1.Columns["morder"].SortIndex = 1;
gridView1.Columns["morder"].SortOrder = DevExpress.Data.ColumnSortOrder.Descending;
gridView1.Columns["module"].Group();
-------------------------------------------------
另外,要使拖拉欄位有效,必須保證如下兩個屬性的設置:
gridView1.OptionsCustomization.AllowSort = true;
gridView1.OptionsView.ColumnAutoWidth = true;