MD *_*med 0 javascript sencha-touch sencha-touch-2
我有一个附在一个商店List.该列表还使用该ListPaging插件启用分页.在我调用load商店的方法(或事件)之后,商店将数据加载到列表中,将请求发送到以下URL:
http://localhost/mysite/nodelist.php?_dc=1359309895493
&tids=1%2C4%2C2%2C5%2C67&page=1&start=0&limit=10
Run Code Online (Sandbox Code Playgroud)
向下滚动列表并按下Load More...(由插件附加到列表中)后,商店会向同一个网址发送另一个请求,但使用不同的参数,启用分页 -
http://localhost/mysite/nodelist.php?_dc=1359310357419
&tids=1%2C4%2C2%2C5%2C67&page=2&start=10&limit=10
Run Code Online (Sandbox Code Playgroud)
现在我想重置商店start和page参数的值.我尝试使用setExtraParam代理上的方法重置它,但如果我这样做,那么控件不会保持分页 - 这意味着当我按下时它不会自动更改page和start参数Load More....
那我该怎么办?
这是我店的示例代码 -
Ext.define('MyApp.store.MyStore', {
extend: 'Ext.data.Store',
requires: [
'Ext.data.reader.Json',
'Ext.data.proxy.Ajax'
],
config: {
autoLoad: false,
model: 'MyApp.model.MyModel',
serverUrl: null,
pageSize: 2,
proxy: {
type: 'ajax',
actionMethods: {
read: 'GET'
},
url: null,
reader: {
type: 'json'
}
},
listeners: {
beforeload: function () {
console.log('Before load');
},
load: function (store) {
// console.log('load');
}
}
}
});
Run Code Online (Sandbox Code Playgroud)
这是列表视图 -
list = {
xtype: 'list',
cls: 'myList',
flex: 12,
itemTpl: '{title}',
store: 'MyStore',
plugins: [
{
xclass: 'Ext.plugin.ListPaging',
autoPaging: false
}
],
listeners: {
select: {
scope: this,
fn: this.onSelect
},
swipe: {
scope: this,
element: 'element',
fn: this.onListSwipe
}
}
};
Run Code Online (Sandbox Code Playgroud)
从查看源代码,也许您正在寻找商店的currentPage配置?
当您使用ListPaging插件加载更多录音时,它所做的就是nextPage在商店中调用,然后loadPage使用currentPage配置调用.如果您currentPage在商店中将配置重置为1,则只会假设开始时间为0,页面当然为1.