Sencha touch 2-更换外部派遣吗? [英] Sencha touch 2- Ext.dispatch replacement?

查看:81
本文介绍了Sencha touch 2-更换外部派遣吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

sencha touch 2中的sencha touch 1.1 Ext.dispatch方法的替代品是什么?

What is the replacement for sencha touch 1.1 Ext.dispatch method in sencha touch 2?

我需要替换下面的代码

listeners:{
    itemtap:function(data,index){
        var record = data.getStore().getAt(index);
         // the record that has been clicked.
         Ext.dispatch({
            controller: 'ControllerName'
            ,action: 'ControllerMethod'
            ,record: record
        });
    }
}

推荐答案

Sencha Touch 2中仍然存在方法Ext.dispatch:

Method Ext.dispatch still exists in Sencha Touch 2: http://docs.sencha.com/touch/2-0/#!/api/Ext.app.Application-method-dispatch

但是,如果由于某种原因而不想使用它,则可以获取控制器的实例并直接调用方法:

But if you just don't like to use it for some reason, you can get an instance of the controller and call method dicrectly:

Ext.ControllerManager.get('ControllerName').ControllerMethod({record: record});

这篇关于Sencha touch 2-更换外部派遣吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆