【发布时间】:2014-06-18 17:13:33
【问题描述】:
使用 Sencha Touch 2.3.1a。我有一个使用 ListPaging 的列表:
{
xtype: 'list',
itemId: 'passDownList',
store: 'PassDownEntrysStore',
plugins:
[
{
xclass: 'Ext.plugin.ListPaging',
autoPaging: true
}
],
grouped : true,
itemTpl: '<div class="list-item-title">{time}</div><div class="list-item-narrative">{firstName} {lastName}</div>',
selectedCls: 'list-item-module',
itemCls: 'list-item-custom',
onItemDisclosure: true,
}
使用以下商店代理设置:
proxy:
{
type: 'ajax',
actionMethods:
{
read : 'POST'
},
extraParams :
{
},
url: App.config.Config.baseURL() + 'subscriptions/',
reader:
{
type: 'json',
totalProperty: 'totalCount',
//totalCount: 'totalCount',
//total: 'totalCount',
rootProperty: 'Data.items',
successProperty: 'success'
}
}
这是从服务器返回的数据:
我已经尝试了所有三种阅读器设置:
totalProperty: 'totalCount',
//totalCount: 'totalCount',
//total: 'totalCount',
并且 totalCount 始终为“未定义”。我尝试在商店中添加加载事件以更新总数:
load: function(records, successful, operation, eOpts)
{
var data = JSON.parse(eOpts._response.responseText);
this.setTotalCount(data.Data.totalCount);
console.log('load call total: ' + this.getTotalCount());
}
设置它。但是,当我拉出列表以显示更多条目并检查加载事件中的总计数时,它再次被重置为“未定义”。
我希望它起作用的原因是它显示“没有更多记录”
更新:2014 年 6 月 18 日: 在负载上设置它对我有用:
load: function(records, successful, operation, eOpts)
{
var data = JSON.parse(eOpts._response.responseText);
this.setTotalCount(data.Data.totalCount);
console.log('load call total: ' + this.getTotalCount());
}
这就是它不断设置总数的原因。我仍然不明白为什么它会返回未定义,所以缺少/错误。但是现在这解决了我的分页问题
【问题讨论】:
标签: sencha-touch