@At @Ok("json") public JDataGrid list_grid( @Attr(scope = Scope.SESSION, value = "account") Account acc, @Param("::columns") List<?> columns, @Param("::search") Map<?, ?> search, int draw, int start, int length) { start = start / length; Pager pager = new Pager(); pager.setPageNumber(start + 1); pager.setPageSize(length); Cnd cnd = Cnd.where("accountid", "=", acc.accountid); if (!Lang.isEmpty(search.get("value")) && !search.get("value").toString().equals("")) { cnd.and("name", "like", search.get("value")); } List<?> aaData = dao.query(Store.class, cnd); pager.setRecordCount(dao.count(Store.class, cnd)); JDataGrid ret = new JDataGrid(); ret.draw = draw; ret.data = aaData; ret.recordsTotal = pager.getRecordCount(); ret.recordsFiltered = pager.getRecordCount(); return ret; }
public Pager createPager(int pageNumber, int pageSize) { Pager pager = new Pager(); pager.setPageNumber(pageNumber); pager.setPageSize(pageSize); return pager; }