gpt4 book ai didi

extjs - Sencha 触摸 : How to load controller dynamically

转载 作者:行者123 更新时间:2023-12-02 04:50:35 26 4
gpt4 key购买 nike

我正在构建一个 sencha touch 应用程序,其中我需要动态地(以编程方式)加载 Controller ,而不是通过在 app.js 中定义它。

最佳答案

试试这段代码:

Ext.require(controller, function() {//controller - "App.controller.Name"
var c = Ext.create(controller, {application: this}), controllers;
c.init();
c.launch();
/*
The "getController" returns "undefined" for a dynamically loaded controller, so the "controllerInstances" should be updated.
*/
controllers = this.getControllerInstances();
controllers[controller] = c;
this.setControllerInstances(controllers);
}, this.getApplication());

关于extjs - Sencha 触摸 : How to load controller dynamically,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18929326/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com