从另一个控制器呼叫控制器的功能/控制器之间共享数据 [英] Call controller's function from another controller / Share data between controllers

查看:140
本文介绍了从另一个控制器呼叫控制器的功能/控制器之间共享数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前来说,当我在一个控制器中,我想从另一个控制器调用一个函数时,我这样做:

  App.app.getControllerInstances()[ 'App.controller.OtherController'] do_something(); 

对我来说似乎有点沉重,还有另一种(更好)的方法吗?我将使用getController方法:http://docs.sencha.com/touch/2-0/# !/api/Ext.app.Application-method-getController



EG: this.getApplication()。getController('ControllerName ').doSomething();


For the moment, when I'm in a controller and that I want to call a function from another controller, I do this :

App.app.getControllerInstances()['App.controller.OtherController'].do_something();

Is seems a bit heavy to me, is there another (better) way to do this ?

Thanks

解决方案

I would use the getController method: http://docs.sencha.com/touch/2-0/#!/api/Ext.app.Application-method-getController

EG: this.getApplication().getController('ControllerName').doSomething();

这篇关于从另一个控制器呼叫控制器的功能/控制器之间共享数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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