分组设置相对简单一点。只需要在正常显示的Grid下,添加一下属性即可。
, grouping: true //设置分组
, groupingView: //设置分组属性
{
groupField: ['Currency'], //设置分组的列
groupColumnShow: [true], // 是否显示分组列
groupText: ['<b>{0} - {1} 条记录{Amount}</b>'], // 设置表头显示的数据。({0}:分组的值,{1}总数据量,以及{Amount}:汇总字段的值)
groupCollapse: false, // 加载数据时是否只显示分组的组信息。true:收缩,false:展开。
groupDataSorted: true, // 分组中的数据是否排序
groupOrder: ['asc'], // 分组后的排序
groupSummary: [true], // 是否显示汇总.如果为true需要在colModel中进行配置
summaryType: 'max', // 运算类型,可以为max,sum,avg</div>
summaryTpl: '<b>Max: {0}</b>',
groupSummaryPos: ['footer'], //汇总数据显示位置,footer或header。默认是footer
showSummaryOnHide: false //是否显示汇总信息并且当收起表格时是否隐藏下面的分组
}
colModel配置
colModel:
{ label: '', width: 60, name: 'Currency', index: 'Currency'},
{ label: '', width: 80, name: 'Amount', index: 'Amount', summaryType: 'max',summaryDivider: true,summaryRound:小数点位数,summaryRoundType:小数点处理方式 },
{ label: ', name: 'PayFlgName', index: 'PayFlgName'},
summaryType可选项:max,min,avg,sum,count。
summaryDivider:求平均值时使用的,具体用法后续补充。