DevExpress gridControl 设置分组统计(组计)
有些代码非常有用,但是用的时候就记不清怎么写,所以就在这里打个草稿。
需要注意的是分组统计的字段不能是分组字段,否则看不到效果就别觉得神奇了,哈哈。
//设置组汇总 private void SetSummation() { this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "TareWeight", colTareWeight, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "GrossWeight", colGrossWeight, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "MiscDeduction", colMiscDeduction, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "RefGrossWeight", colRefGrossWeight, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "NetWeight", colNetWeight, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "H2O", colH2O, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "H2O2", colH2O2, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "H2OQuantity", colH2OQuantity, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "DryWeight", colDryWeight, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "Cu", colCu, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "Cu2", colCu2, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "Au", colAu, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "Au2", colAu2, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "AuQuantity", colAuQuantity, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "Ag", colAg, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "Ag2", colAg2, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "AgQuantity", colAgQuantity, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "Pb", colPb, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "Zn", colZn, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "Sb", colSb, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "Sb2", colSb2, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "Sb", colSb, "{0:N3}"); this.gridViewShipment.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "Sb2", colSb2, "{0:N3}"); }