本文介绍了jquery easyui中datagrid使用合计行显示汇总信息的方法,需要的朋友参考下。
在jquery easyui中使用datagrid合计行,可以是多行,如下图:
合计行的数据由datagrid的数据源提供,如下:
{"total":1,"rows":[{"id":1,"name":"Chai","price":18.00}],"footer":[{"name":"Total","price":18.00}]}
要使用合计行必须设置showFooter为true:
$('#tt').datagrid({
url: 'datagrid_data.json',
title: 'DataGrid',
width: 400,
height: 220,
fitColumns: true,
rownumbers:true,
showFooter:true,
columns:[[
{field:'name',title:'Product Name',width:80},
{field:'price',title:'Unit Price',width:40,align:'right'}
]]
});