3 sencha-touch-2 pull-to-refresh
在标准的"Pull to Refresh"插件中,列表存储得到更新.但是,我有两个列表,我需要为我的详细列表更新不同的商店.如何覆盖更新事件并重新加载我的其他商店?我尝试添加一个简单的监听器,但它没有触发.
[更新]
我从Sencha网站获得了这个代码片段:
plugins: [
{
xclass: 'Ext.plugin.PullRefresh',
pullRefreshText: 'Pull down for more new Events!',
refreshFn: function(plugin) {
console.log( "I'm pulled" );
}
}
]
原始代码:
Ext.define('SenchaFiddle.view.ListView', {
extend: 'Ext.dataview.List',
xtype: 'main-list',
config: {
plugins: [
'pullrefresh',
{
pullRefreshText: 'Do it!',
type: 'listpaging',
// Don't offer "Load More" msg
autoPaging: false,
refreshFn: function() {
console.log("Boom");
},
listeners: {
'updatedata': function(plugin, list) {
console.log("Getting the data");
}
}
}
],
layout: 'fit',
width: 300,
itemTpl: '{text}'
}
});
在Sencha Touch 2.2中,他们refreshFn从Ext.util.PullRefresh中删除了配置.我refreshFn通过覆盖fetchLatestExt.util.PullRefresh中的函数成功实现了新版Sencha Touch 的自定义,如此...
Ext.define('MyApp.overrides.PullRefreshOverride', {
override: 'Ext.plugin.PullRefresh',
fetchLatest: function() {
var list = this.getList();
switch(list.getItemId()) {
case "list1":
this.updateStore1();
break;
case "list2":
this.updateStore2();
break;
}
this.callParent(arguments);
},
//My own custom function to add to the plugin
updateStore1: function() {
//Code to update store 1
},
//My own custom function to add to the plugin
updateStore2: function {
//Code to update store 2
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6789 次 |
| 最近记录: |