Sencha touch 未设置Sencha Touch ListPaging TotalCount
使用Sencha Touch 2.3.1a。我有一个使用ListPaging的列表:Sencha touch 未设置Sencha Touch ListPaging TotalCount,sencha-touch,Sencha Touch,使用Sencha Touch 2.3.1a。我有一个使用ListPaging的列表: { xtype: 'list', itemId: 'passDownList', store: 'PassDownEntrysStore', plugins: [ { xclass: 'Ext.plugin.ListPaging', autoPaging: true } ],
{
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());
}
这就是为什么它一直设置总数。我仍然不明白为什么它返回时没有定义,所以缺少了一些东西/bug。但就目前而言,这解决了我的分页问题实际上在读卡器配置中设置了
totalProperty:“count”
在与RESTAPI交互时对我有效,但您的更新也有效
代理设置示例(顺便说一句,它不在存储配置中,而是在模型中)
我有2.3.1a版,我不是订户,所以在2.3.2版可用之前无法下载。我得等到那时。希望这只是一个bug。ThanksI也有2.3.1,它(totalProperty参数)按预期工作。与代码的一个不同之处是,我使用的是服务器响应中的'count'参数,而不是'totalCount'。。我不知道这是否重要。我只是试着使用count,比如:count:'totalCount'和nothing。你能发布一个你的商店的例子来看看吗
proxy: {
type: 'rest',
url : 'https://*******.info/api/v3/posts/',
withCredentials: false,
useDefaultXhrHeader: false,
reader : {
type : 'json',
rootProperty : 'results',
totalProperty : 'count'
}
//format :'json'
}