Sencha touch Ext.plugins.ListPagingPlugin";pullrefresh";汉化

Sencha touch Ext.plugins.ListPagingPlugin";pullrefresh";汉化,sencha-touch,extjs,Sencha Touch,Extjs,我正在尝试添加一个侦听器到以下内容,但它不会启动 plugins: [{ ptype: 'pullrefresh', autoPaging: true, listeners: { 'released': function(plugin,list){ // call the plugins processComple

我正在尝试添加一个侦听器到以下内容,但它不会启动

plugins: [{
                ptype: 'pullrefresh',
                autoPaging: true,
                listeners: {
                     'released': function(plugin,list){
                       // call the plugins processComplete method to hide the 'loading' indicator
                      /* your_store.on('load', plugin.processComplete,     plugin, {single:true});
                       // do whatever needs to happen for reload
                       your_store.load();*/
                       alert('test');
                     }
                }
            }],
我想做的是,当触发刷新事件时,有人拉列表,我们获取用户的纬度和经度,并将值加载到存储中。我的问题是加载前的存储:事件没有正确的事件冒泡,因此它会在获取用户地理位置之前触发存储json调用

My Store{

listeners: {
        beforeload: function(){

            console.log( 'me1' );
            //call this to write to location services on device
            if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(function(position) {
                    console.log( 'me2' );
                    Rad.stores.games.getProxy().extraParams.lat  = position.coords.latitude;
                    Rad.stores.games.getProxy().extraParams.long  = position.coords.longitude;  
                }); 
            }
            console.log( 'me3' );
        }
    }
}
如果你看控制台,它会显示me1,me3,me2。。。。我想让它显示我1,我2,我3


我已经看过了所有的论坛和文档,但我想我只是需要一些关于设置侦听器和事件冒泡的指导。谢谢。

以下是您的操作方法:刷新fn

        // pull refresh and listupdate plugins
        plugins: [
            {
                ptype: 'pullrefresh',
                refreshFn: function(callback, plugin) {
                    console.log( 'me1' );
                    if (navigator.geolocation) {
                        navigator.geolocation.getCurrentPosition(function(position) {
                            console.log( 'me2' );
                            Rad.stores.games.getProxy().extraParams.lat  = position.coords.latitude;
                            Rad.stores.games.getProxy().extraParams.long  = position.coords.longitude;  
                            var store = plugin.list.getStore();
                            store.load(function(records, operation, success) {
                                callback.call(plugin);
                                console.log( 'me3' );
                            });
                        }); 
                    }
                }
            },
            {
                ptype: 'listpaging',
                autoPaging: false,  
            }
        ],
这是商店:

  Rad.stores.games = new Ext.data.Store({
id: 'games',
model: 'games',
autoLoad:false,
    clearOnPageLoad: false, 
proxy: {
   type: 'ajax',
   url : 'ajax/lc.php',
   reader: {
        type: 'json',
        root: 'results'
   }
},
extraParams:{
    format:'json'
}
}))


我发现sencha touch没有足够的工作示例,所以我会在找到问题的时候继续发布答案

为了配合Sencha 2.1和我的需要,我对它进行了一些更新

我需要在触发pullRefresh时设置一些额外参数(在我的例子中,用于显示同一提要的不同筛选器)。上面的例子很有帮助,但我不得不做一些调整——这对我在SenchaTouch2.1上的工作是有效的

我的存储名为“Questions”,我需要根据用户切换提要(MyApp.util.Config.currentFeed)时设置的变量设置“type”参数。希望这对别人有帮助

plugins: [
{
  xclass: 'Ext.plugin.PullRefresh',
  pullRefreshText: 'Pull to refresh...',
  refreshFn: function() {
    console.log( 'firing pullrefresh event' );
    var store = Ext.getStore('Questions');
    store.getProxy().setExtraParam('type',MyApp.util.Config.currentFeed);
    Ext.Viewport.setMasked({
      xtype: 'loadmask'
    });
    store.load(function(records, operation, success) {
      console.log( 'finished pullrefresh event' );
      Ext.Viewport.setMasked(false);
    });
  }
}]

我很高兴你找到了答案,但是你能把它作为答案(下面)而不是作为问题的编辑添加吗?等待一段时间后,您将被允许选择正确,这将结束您的问题。这有点奇怪,但我们就是这样做的。谢谢。这是对的…:)尤其是SenchaTouch2.0。有很多东西需要修改..我已经放弃了Sencha JQM是一条走下去的路,或者只是走本土化的路.我的评论来自一年多以前。。我不想让人们泄气。在此期间,情况发生了变化。我的观点是,对于大型/企业应用程序,JQM缺少ST可以提供的结构。我在ST和JQM方面都有经验,我必须使用类似knockoutJS的框架和大量的想象力来完成一个像样的项目。但是,如果你想要一个小应用程序,并且需要学习ST,那么JQM肯定会起作用。大多数开发人员已经知道jQuery,因此学习曲线不会太陡。如果您能够分别在每个主要平台上进行开发,那么Native总是最好的。但这一切都有点离题:)