easyui datagrid 显示 footer
1、设置 showFooter为true
$grid = $dg.datagrid({ // fit: true, //fitColumns: true, // pagination: false, // pageSize: 20, // pageList: [20, 40, 60, 80, 100], showFooter:true, scrollbarSize:0, border: true, striped: true, singleSelect: false, selectOnCheck: true, checkOnSelect: true, remoteSort:false, rownumbers : false,//不显示序号 method:'get', columns: [[{field: 'companyname', title: '经销商名称', width: parseInt($(this).width() * 0.2)}, {field: 'goodscount', title: '新增sku数', width: parseInt($(this).width() * 0.1),sortable:true,sorter:numberSort}, {field: 'upgoodscount', title: '在售sku数', width: parseInt($(this).width() * 0.1),sortable:true,sorter:numberSort}, {field: 'goodsSaleCount', title: '下单商品数', width: parseInt($(this).width() * 0.1),sortable:true,sorter:numberSort} ]], onBeforeLoad: function (param) { try { let row = $(this).datagrid('getSelected'); let index = $(this).datagrid('getRowIndex', row); row_key = index; } catch (err) { console.log(err); } }, onClickCell: function (index, field, value) { $(this).datagrid('clearSelections'); }, onLoadSuccess: function (data) { $(this).datagrid('checkRow', row_key); }, toolbar: '#tb' });
2、json数据,主要是footer 数组对象
{"total":9,"rows":[
{"id":1,"name":"Chai","price":18.00},
{"id":2,"name":"Chang","price":19.00},
{"id":3,"name":"Aniseed Syrup","price":10.00},
{"id":4,"name":"Chef Anton's Cajun Seasoning","price":22.00},
{"id":5,"name":"Chef Anton's Gumbo Mix","price":21.35},
{"id":6,"name":"Grandma's Boysenberry Spread","price":25.00},
{"id":7,"name":"Uncle Bob's Organic Dried Pears","price":30.00},
{"id":8,"name":"Northwoods Cranberry Sauce","price":40.00},
{"id":9,"name":"Mishi Kobe Niku","price":97.00}
],"footer":[
{"name":"Total","price":282.35},
{"name":"Average","price":31.37}
]}

浙公网安备 33010602011771号