分页后有这么一条:
displayMsg : '显示第 {0}条到 {1}条记录,一共 {2}条',
其中的参数{2}是通过ds.data.length来的,还是通过ds里面的:totalProperty来的。
因为现在出现这个问题:ds中的totalProperty为6,但是我分页是3条一页的,
结果出来是这样的:
显示第 1条到 3条记录,一共 3条
请各位帮忙看看。
var cm = new Ext.grid.ColumnModel([ {
header : "customerId",
width : 120,
dataIndex : 'customerId',
hidden : true
}, {
header : "客户名称",
width : 120,
dataIndex : 'name'
}, {
header : "电子邮件",
width : 200,
dataIndex : 'email',
align : 'right'
}]);var ds = new Ext.data.Store( { proxy : new Ext.data.HttpProxy( { url : 'listFollowingCustomerAjax.action' }), reader : new Ext.data.JsonReader( { totalProperty : 'count', root : 'values' }, [ { name : 'customerId' }, { name : 'name' }, { name : 'email' }]) }); ds.load( { params : { start : 0, limit : 3 } }); var grid = new Ext.grid.GridPanel( { ds : ds, cm : cm, id : 'followingCusotmer', title : '跟进中客户列表', autoHeight : true, width : '100%', loadMask : true, buttons : [ { text : '查询', tooltip : '客户查询', handler : function() { alert(ds.data.length); } }, { text : '关闭', tooltip : '关闭窗口' }], buttonAlign : 'right', bbar : new Ext.PagingToolbar( { id : 'pagingbar', pageSize : 3, store : ds, displayInfo : true, displayMsg : '显示第 {0}条到 {1}条记录,一共 {2}条', emptyMsg : "没有记录" }) });</pre><br /><strong>问题补充:</strong><br /><pre name="code" class="java">url : 'listFollowingCustomerAjax.action' </pre><br />返回的json中,count:6<br />好奇怪。<br /><strong>问题补充:</strong><br />呵呵,因为本来发了问题,没找到,到论坛又发了一次。<br /><br />谢谢你,自己发现错误了,原来JAVA中的变量不是count,导致取不到6.但是不是他取不到6就会去取ds.data.length??