做技术3年了,头次意识到写技术博客的重要性,于是将工作遇到的技术细节决定从今开始用博客记录下来。
sencha touch 使用list的时候有个pullrefresh插件,使用很方便。能刷新当前使用list对应的的store。
问题是当list需要按照用户权限进行不同内容显示的时候,pullrefresh会将后台所有数据都拿出。
这个时候需要改动sencha源码:
目录:touch-src-plugin-PullRefresh.js
代码位置:248行加入params:store.getParams(),
这样之前在分权限定义store的params的时候,在下拉refresh的时候参数也会被传入后台。
fetchLatest: function() {
var store = this.getList().getStore(),
proxy = store.getProxy(),
operation;
operation = Ext.create('Ext.data.Operation', {
page: 1,
start: 0,
model: store.getModel(),
limit: store.getPageSize(),
params:store.getParams(),
action: 'read',
sorters: store.getSorters(),
filters: store.getRemoteFilter() ? store.getFilters() : []
});
proxy.read(operation, this.onLatestFetched, this);
}