前台部分:
Ext.define('GS.system.role.store.RoleGridStore',{ extend:'Ext.data.Store', model:'GS.system.role.model.RoleGridModel', id:'roleStoreId', pageSize:4,//分页大小 proxy:{ type:'ajax', url:'/gs_erp/roleAction!getRoleList', reader: { type: 'json', root: 'rows', totalProperty: 'total' } }, sorters: [{ property: 'id', //排序字段 direction: 'asc'// 默认ASC }], autoLoad:{start: 0, limit: 4}//start是从第几条开始,limit是每页的条数});store.loadPage(1); //加载第一页
private int limit;//每一页的条数 private int start;//从哪一条数据开始查 private int total;//总条数 /** * 查找所有角色 */ public void getRoleList() { ListroleList=new ArrayList (); StringBuffer toJson=new StringBuffer();//用来放json数据 System.out.println(start+","+limit+","+total); try { roleList=(List ) pageServiceImpl.commonPagination(Role.class, "", start, limit); total=pageServiceImpl.getTotalNum(Role.class, ""); toJson.append("{total:").append(""+total+"").append(",success:true,").append("start:") .append(""+start+"").append(","); toJson.append("rows:["); for(int i=0;i