后台
@RequestMapping(params = "datagrid3") public void datagrid3(LdcOrderTaxEntity decOrder,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { String invoiceno = request.getParameter("invoiceno"); String wheresql = ""; if(!"".equals(invoiceno)&&invoiceno!=null){ wheresql = " and invoiceno = '"+invoiceno+"'"; } String hql = "from LdcOrderTaxEntity where 1=1 " +wheresql; List<LdcOrderTaxEntity> ldcOrdertaxList = decOrderService.findHql(hql); List<Object> arrayList = new ArrayList<>(); for (int i = (dataGrid.getPage()-1)*dataGrid.getRows(); i < dataGrid.getRows()*dataGrid.getPage(); i++) { if(StringUtil.isNotEmpty(ldcOrdertaxList)) { if(i<=(ldcOrdertaxList.size()-1)){ arrayList.add(ldcOrdertaxList.get(i)); } dataGrid.setTotal(ldcOrdertaxList.size()); } } dataGrid.setResults(arrayList); TagUtil.datagrid(response, dataGrid); }
前台
添加属性:pagination="true"
<t:datagrid name="decOrderList" checkbox="true" fitColumns="true" title="业务订单表" sortName="createDate" actionUrl="decOrderController.do?datagrid3" pagination="true" idField="id" fit="true" queryMode="group">