2024年4月4日发(作者:)

Dev 控件之:datacontrol 分组,合计Summary:(Footer summary) (row footer summary)

(Row summary) 设置

1.样式图:

图一:分组

图2:小计合计

2.分组:如图一所示

lumn column = s["流水号"];//拿到要分

组的列

if (column == null) return;

ndex = 0; //未分组情况下列的GroupIndex为-1,所有都是一个组

3.(Footer summary)总体合计:也就是图2表的右下角利润合计

代码如下:

lumn col_Profit = s["参考利润"];

s["参考利润"].yType =

;

s["参考利润"].yFormat = "利润合计:

{0:c2}";

4.(row footer summary)小计的出现:

或许是本人愚钝,小计的出现还是费了点波折:

注:下面是dev帮助文档提供的资料,但这是直接从界面绑定数据的作法

Add summary items by clicking Add, and customize them.

A single item is represented by a GridGroupSummaryItem class object, which is a

GridSummaryItem class descendant. It provides the following main properties.

- yType - Specifies the type of summary to calculate against

groups.

- ame - Specifies the field against which the summary must be

calculated.

- GroupColumnFooter - Specifies where to display group

summary values - in group rows or in a specific column's footer.

- yFormat - Allows you to customize the display format of group

summary values.

Here we use the yFormat property for demonstration purposes.

To learn more about summary value formats, see Format Summary Values.

如果您的数据源是从程序中绑定的,或许下面的内容对您有用:

GridGroupSummaryItem item1 = new GridGroupSummaryItem();

ame = "参考利润;

yType = ;

yFormat = "利润小计: {0:c2}";//格式

GroupColumnFooter = col_Profit;//这句就是给groupcolumnfooter加上