반응형
그리드의 summary에 특정 조건의 값만 합할 때 다음 코드를 사용.
//전역 double AAA = 0; int BBB = 0; //Calc advBandedGridViewDetail.CustomSummaryCalculate += (sender, e) => { AdvBandedGridView view = sender as AdvBandedGridView; switch (e.SummaryProcess) { case DevExpress.Data.CustomSummaryProcess.Start: if (((DevExpress.XtraGrid.GridColumnSummaryItem)e.Item).FieldName == "AAA") AAA = 0; if (((DevExpress.XtraGrid.GridColumnSummaryItem)e.Item).FieldName == "BBB") BBB = 0; break; case DevExpress.Data.CustomSummaryProcess.Calculate: if (view.GetRowCellValue(e.RowHandle, view.Columns["CNCL_YN"]).ToString() == "N") { if(((DevExpress.XtraGrid.GridColumnSummaryItem)e.Item).FieldName== "AAA") AAA += double.Parse(view.GetRowCellValue(e.RowHandle, "AAA").ToString()); if (((DevExpress.XtraGrid.GridColumnSummaryItem)e.Item).FieldName == "BBB") BBB += int.Parse(view.GetRowCellValue(e.RowHandle, "BBB").ToString()); } break; case DevExpress.Data.CustomSummaryProcess.Finalize: if (((DevExpress.XtraGrid.GridColumnSummaryItem)e.Item).FieldName == "WRHS_QN_UNIT") e.TotalValue = AAA; if (((DevExpress.XtraGrid.GridColumnSummaryItem)e.Item).FieldName == "BBB") e.TotalValue = BBB; break; } }; // advBandedGridViewDetail.Columns["AAA"].Summary.Add(DevExpress.Data.SummaryItemType.Custom, "AAA", "{0:#,##0}"); advBandedGridViewDetail.Columns["BBB"].Summary.Add(DevExpress.Data.SummaryItemType.Custom, "BBB", "{0:#,##0}");
반응형
'Winform' 카테고리의 다른 글
.net socket chatting sample (1) (0) | 2021.04.15 |
---|---|
기본 combobox (1) | 2020.09.04 |
[DevExpress] 그리드의 체크박스 한개만 선택 할때 (0) | 2019.01.23 |
[DevExpress] TextEdit에 Invalid Value 아이콘 제거 하기. (4) | 2019.01.22 |
Devexpress Grid LostFocus Event (2) | 2018.12.19 |
댓글