Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
759 views
in Technique[技术] by (71.8m points)

extjs - Call controller's function from another controller / Share data between controllers

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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();


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...