上面datagrid对应的代码如下:
1 $('#tbCheckOut').datagrid({ 2 title: '待分配库位', 3 iconCls: 'icon-search', 4 width: 1112, 5 height: 500, 6 rownumbers: true, 7 idField: 'ID', 8 sortOrder: 'desc', 9 sortName: 'ID', 10 remoteSort: false, 11 nowrap: false, 12 collapsible: true, 13 striped: true, 14 fitColumns: false, 15 pagesize: 10, 16 pagination: true, 17 url: '/StockOut/WebAjax/ProcCheckOutList.ashx', 18 queryParams: convertArray($('#fmSearch').serializeArray()), 19 onLoadSuccess: function (data) { 20 $('#tbCheckOut').datagrid('collapseGroup'); //设置折叠 21 }, 22 onDblClickCell: function (index, field, value) { 23 }, 24 columns: [[ 25 { field: 'singlechk', width: 50, checkbox: true}, 26 { field: 'CheckOutType', title: '单据类型', width: 80, align: 'center', sortable: true, formatter: function (value, row) { 27 return FGetCheckOutTypeInfo(value); 28 } 29 }, 30 { field: 'PostTime', title: '下单日期', width: 70, align: 'center', sortable: true, formatter: function (value, row) { 31 return ChangeShortDateFormat(value); 32 } 33 }, 34 { field: 'K3OrderCode', title: '编号', width: 120, align: 'center', sortable: true }, 35 { field: 'SerialNo', title: '流水号', width: 120, align: 'center', sortable: true }, 36 { field: 'CustomName', title: '客户', width: 200, align: 'center', sortable: true, formatter: function (value, row) { 37 var rtnStr = value; //todo 截取 38 return rtnStr; 39 } 40 }, 41 { field: 'ItemSNCode', title: '物料编码', width: 120, align: 'center', sortable: true }, 42 { field: 'SKUCode', title: 'SKU', width: 50, align: 'center', sortable: true }, 43 { field: 'ItemSNName', title: '物料名称', width: 250, align: 'center', sortable: true }, 44 { field: 'AssignNum', title: '计划', width: 50, align: 'center', sortable: true }, 45 { field: 'ActualNum', title: '实际', width: 50, align: 'center', sortable: true }, 46 { field: 'HasAllotedNum', title: '已分配', width: 50, align: 'center', sortable: true }, 47 { field: 'UnitName', title: '单位', width: 50, align: 'center', sortable: true }, 48 { field: 'SpecificationsName', title: '规格型号', width: 60, align: 'center', sortable: true }, 49 { field: 'WarehouseName', title: '发货仓库', width: 100, align: 'center', sortable: true }, 50 { field: 'ChannelName', title: '渠道', width: 30, align: 'center', sortable: true }, 51 { field: 'ID', title: '操作', width: 120, align: 'center', formatter: function (value, row) { 52 var rtnStr = ""; 53 if (row.Status == 0) { 54 rtnStr = '<a href="javascript:void()" class="gridAColor" onclick="FProcTask(1,' + value + ')">自动出库</a> <a href="javascript:void()" onclick="FProcTask(0,' + value + ')" class="gridAColor" >手动出库</a>'; 55 } 56 return rtnStr; 57 } 58 } 59 ]], 60 groupField: 'K3OrderCode', 61 view: groupview, 62 63 groupFormatter: function (value, rows) { 64 var rtnStr = ""; 65 rtnStr += '<input type="checkbox" onclick="FGPCkbClick(this)" helpGPVal="' + value + '" name="gpChk" />'; 66 rtnStr += value + ' 单据数量=' + rows.length + '条'; 67 var sumAssignNum = 0; 68 var sumActualNum = 0; 69 for (var i = 0; i < rows.length; i++) { 70 sumAssignNum += rows[i].AssignNum; 71 sumActualNum += rows[i].ActualNum; 72 } 73 rtnStr += " 计划量=" + sumAssignNum; 74 rtnStr += " 实际量=" + sumActualNum; 75 return rtnStr; 76 } 77 });