extjs4分页问题,totalCount不起作用 10
jsp代码varitemsPerPage=10;varstore=Ext.create('Ext.data.Store',{storeId:'simpsonsStore'...
jsp代码
var itemsPerPage = 10;
var store = Ext.create('Ext.data.Store', { storeId:'simpsonsStore', fields:['username', 'realname', 'flag','createdate'], //data:sdata, pageSize:itemsPerPage, proxy: { type: 'ajax', url:'t100_user_list_ajax', actionMethods:{ read:'POST' }, reader: { type: 'json', root: 'jsonArray', totalProperty: 'totalCount' //怎么都不起作用 } }, autoLoad:{params: {start: 0, limit:itemsPerPage}} });
grid分页部分
{ // Results grid specified as a config object with an xtype of 'grid' xtype: 'grid', columnWidth:'20%', id:'gridid', forceFit: true, selModel: Ext.create('Ext.selection.CheckboxModel'), columns: [ {text: '用户名',dataIndex: 'username'}, {text: '真实姓名',dataIndex: 'realname'}, {text: '状态',dataIndex: 'flag'}, {text: '创建日期',dataIndex: 'createdate'}], // One header just for show. There's no data, store: store, // A dummy empty data store dockedItems: [{ xtype: 'pagingtoolbar', store: store, // same store GridPanel is using dock: 'bottom', displayInfo: true }], flex: 2 // Use 1/3 of Container's height (hint to Box layout) }
struts2代码
<action name="t100_user_list_ajax" method="t100_user_list_ajax" class="com.createwhit.t100_user.T100_userAction"> <result type="json"></result> </action>
java代码
public String t100_user_list_ajax() { ArrayList<T100_user> list = null; try { T100_userDAO t100_userDAO = (T100_userDAO) context .getBean("t100_userDAO"); list = t100_userDAO.t100_user_list(formToDto(username),this.start,this.limit); this.getTotalCount("t100_user_count",formToDto(username)); jsonArray = JSONArray.fromObject(this.distConvert(list, "flag,T10001")); } catch (Exception e) { e.printStackTrace(); } return SUCCESS; }
这种查出的结果就是这样
实际上我的记录总数是25条记录,可以分成三页,但前台页面只显示只有一页,搞不懂了,请大神指教? 展开
var itemsPerPage = 10;
var store = Ext.create('Ext.data.Store', { storeId:'simpsonsStore', fields:['username', 'realname', 'flag','createdate'], //data:sdata, pageSize:itemsPerPage, proxy: { type: 'ajax', url:'t100_user_list_ajax', actionMethods:{ read:'POST' }, reader: { type: 'json', root: 'jsonArray', totalProperty: 'totalCount' //怎么都不起作用 } }, autoLoad:{params: {start: 0, limit:itemsPerPage}} });
grid分页部分
{ // Results grid specified as a config object with an xtype of 'grid' xtype: 'grid', columnWidth:'20%', id:'gridid', forceFit: true, selModel: Ext.create('Ext.selection.CheckboxModel'), columns: [ {text: '用户名',dataIndex: 'username'}, {text: '真实姓名',dataIndex: 'realname'}, {text: '状态',dataIndex: 'flag'}, {text: '创建日期',dataIndex: 'createdate'}], // One header just for show. There's no data, store: store, // A dummy empty data store dockedItems: [{ xtype: 'pagingtoolbar', store: store, // same store GridPanel is using dock: 'bottom', displayInfo: true }], flex: 2 // Use 1/3 of Container's height (hint to Box layout) }
struts2代码
<action name="t100_user_list_ajax" method="t100_user_list_ajax" class="com.createwhit.t100_user.T100_userAction"> <result type="json"></result> </action>
java代码
public String t100_user_list_ajax() { ArrayList<T100_user> list = null; try { T100_userDAO t100_userDAO = (T100_userDAO) context .getBean("t100_userDAO"); list = t100_userDAO.t100_user_list(formToDto(username),this.start,this.limit); this.getTotalCount("t100_user_count",formToDto(username)); jsonArray = JSONArray.fromObject(this.distConvert(list, "flag,T10001")); } catch (Exception e) { e.printStackTrace(); } return SUCCESS; }
这种查出的结果就是这样
实际上我的记录总数是25条记录,可以分成三页,但前台页面只显示只有一页,搞不懂了,请大神指教? 展开
展开全部
请问你查看了后台传到页面上的值包含了totalCount的值吗?
追问
我后台是通过private int totalCount = 0,以及set、get方法,然后
this.getTotalCount("t100_user_count",formToDto(username));
这是赋值的过程,断点查看没有问题,里面有值啊!!!!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
好像,你的Grid部分少了pageSize属性。我也出现了类似的情况,不过,我没有在store里设置pageSize,加上之后分页成功。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询