Ext 2 分页问题

分页后有这么一条:

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??

[code="js"]
getTotalCount : function(){
return this.totalLength || 0;
}

loadRecords : function(o, options, success){
if(!o || success === false){
if(success !== false){
this.fireEvent("load", this, [], options);
}
if(options.callback){
options.callback.call(options.scope || this, [], options, false);
}
return;
}
var r = o.records, t = o.totalRecords || r.length;
if(!options || options.add !== true){
if(this.pruneModifiedRecords){
this.modified = [];
}
for(var i = 0, len = r.length; i < len; i++){
r[i].join(this);
}
if(this.snapshot){
this.data = this.snapshot;
delete this.snapshot;
}
this.data.clear();
this.data.addAll(r);
this.totalLength = t; //这个复制
this.applySort();
this.fireEvent("datachanged", this);
}else{
this.totalLength = Math.max(t, this.data.length+r.length);//或者这里
this.add(r);
}
this.fireEvent("load", this, r, options);
if(options.callback){
options.callback.call(options.scope || this, r, options, true);
}
}
[/code]

你 ds.getTotalCount()看下是多少

listFollowingCustomerAjax.action 拿json贴出来我测试.怎么你提两个一样的问题呢?