easyui-datagrid-前台分页.js /** * @returns */function configDetailedDatagrid(){$("#buildingList").datagrid({toolbar:[{text:'导出', id:'btn_detail_out', iconCls:'icon-out', handler:function(){ detailExcelOutput(); }},{text:'立即返回
/** * @returns */ function configDetailedDatagrid(){ $("#buildingList").datagrid({ toolbar:[{ text:'导出', id:'btn_detail_out', iconCls:'icon-out', handler:function(){ detailExcelOutput(); } },{ text:'立即返回', id:'btn_return', iconCls:'icon-out', handler:function(){ } }], onLoadSuccess:function(data) { // 隐藏表头的全选checkbox $("#buildingList").parent().find("div .datagrid-header-check").children("input[type=\"checkbox\"]").eq(0).attr("style", "display:none;"); }, onCheck:function(index, data){ }, onUncheck:function(index, data){ } }); // 前台分页 $('#buildingList').datagrid({loadFilter:pagerFilter}); function pagerFilter(data){ if(typeof data.length=='number' && typeof data.splice=='function'){//判断数据是否数组 data={total:data.length,rows:data}; } var dg = $(this); var opts = dg.datagrid('options'); var pager = dg.datagrid('getPager'); pager.pagination({ onSelectPage:function(pageNum,pageSize){ opts.pageNumber = pageNum; opts.pageSize = pageSize; pager.pagination('refresh',{ pageNumber:pageNum, pageSize:pageSize }); dg.datagrid('loadData',data); } }); if(!data.originalRows){ data.originalRows=(data.rows); } var pageNo = $('#buildingList').datagrid('getPager').data("pagination").options.pageNumber; var start = (opts.pageNumber-1)*parseInt(opts.pageSize); var end = start+parseInt(opts.pageSize); data.rows = (data.originalRows.slice(start,end)); return data; } }