grid = $("#dg").datagrid({ url: 'issue.do?method=getOrdersInfo', fit: true, idField: 'id', rownumbers: true, singleSelect: false, selectOnCheck: true, checkOnSelect: true, showFooter: true, onLoadSuccess: compute, toolbar: '#tb', columns: [[{ field: 'ck', checkbox: true }, { field: 'dname', title: '所属机构', width: 200, align: 'center' }, { field: 'suppname', title: '供应商', width: 200, align: 'center' }, { field: 'cityname', title: '收货区域', width: 200, align: 'center' }, { field: 'tboxsum', title: '周转箱数量', width: 200, align: 'center' }, { field: 'nowtime', title: '出库时间', width: 200, align: 'center' }, { field: 'tsid', title: '供应商id', width: 100, align: 'center', hidden: 'true' }, { field: 'rdcid', title: 'RDC仓id', width: 100, align: 'center', hidden: 'true' } ]], pagination: true, pageSize: 100, pageList: [100, 200, 1000], }); });
//导出 function putoutfile() { var allRows2 = $("#dg").datagrid("getColumnFields"); var colName = []; var fieldName = []; for (var i = 1; i < allRows2.length; i++) { var col = $('#dg').datagrid("getColumnOption", allRows2[i]); colName.push(col.title);//把title列名到数组里去 fieldName.push(col.field); //把field列属性名到数组里去 } //截取数组,不显示隐藏的列 colName = colName.slice(0, 5); fieldName = fieldName.slice(0, 5); $("#fieldName").val(fieldName.join(",")); $("#headtitle").val(colName.join(",")); var outputform = $("#outputform"); outputform.submit(); }