你好,我在C1FlexGrid中把数据分组显示
并且在某些列使用了this.flexGrid.Aggregate(AggregateEnum.Sum, range.r1, colIndex, range.r2, colIndex, AggregateFlags.ExcludeNodes);
来计算列的合计值。
如果我使用FlexGrid的过滤功能,隐藏了几行,此时想从新计算该列的合计值,不计算隐藏的行,请问怎样处理呢?谢谢!
private void AddSubtotals(string columnName)
{
int colIndex = this.flexGrid.Cols.IndexOf(columnName);//
for (int r = this.flexGrid.Rows.Fixed; r < this.flexGrid.Rows.Count; r++)
{
if (this.flexGrid.Rows[r].IsNode)
{
var node = this.flexGrid.Rows[r].Node;
// 计算合计值
var range = node.GetCellRange();
var sum = this.ShiharaiListEntryFlexGrid.Aggregate(AggregateEnum.Sum,
range.r1, colIndex, range.r2, colIndex,
AggregateFlags.ExcludeNodes);
this.flexGrid[r, colIndex] = sum;
}
}
}
|