查詢頁面根據某一列分組程式碼
阿新 • • 發佈:2021-06-11
private void FormPMOMMABW03_EF_DO_F7(object sender, EF.EF_Args e) { this.isGrouped = !this.isGrouped; this.gridView1.ClearSorting(); if (this.isGrouped) { this.gridView1.Columns["ST_NO"].GroupIndex = 0;this.gridView1.Columns["ST_NO"].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Count; this.gridView1.Columns["ST_NO"].SummaryItem.DisplayFormat = "個數:{0}"; this.gridView1.Columns["ST_NO"].SummaryItem.FieldName = "ST_NO"; this.gridView1.Columns["NOM_SLAB_WT"].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum; this.gridView1.Columns["NOM_SLAB_WT"].SummaryItem.DisplayFormat = "總重:{0}T"; this.gridView1.Columns["NOM_SLAB_WT"].SummaryItem.FieldName = "NOM_SLAB_WT"; this.gridView1.GroupSummary.Add(DevExpress.Data.SummaryItemType.Count, "ST_NO", this.gridView1.Columns["ST_NO"], "小計: {0}個"); this.gridView1.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "NOM_SLAB_WT", this.gridView2.Columns["NOM_SLAB_WT"], "總重: {0}噸"); gridView1.ExpandAllGroups(); } else { this.gridView1.Columns["ST_NO"].GroupIndex = -1; } this.gridView1.BestFitColumns(); }