今天碰到有同事遇到这个方面的需求,贴一下吧。
private void gvTop_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e)
{
if (e.IsTotalSummary && e.SummaryProcess == CustomSummaryProcess.Finalize)
{
// 数据源
var data = this.gcTop.DataSource as List<StockOrderDetail_V>;
// 统计项
var item = e.Item as GridColumnSummaryItem;
switch (item.FieldName)
{
case "FACTAMT":
data = data.FindAll(x => x.IsChecked == 1);
e.TotalValue = data.Sum(x => x.FACTAMT);
break;
default:
break;
}
}
}
时间: 2024-11-01 10:15:41