首页 > 代码库 > Extjs 4 如何动态加载 Controller

Extjs 4 如何动态加载 Controller

Ext.application.prototype.addController = function (name) {
var me = this;
var controller = AM.getApplication().getController(name);
if (!controller) {
controller = Ext.create(this.getModuleClassName(name, ‘controller‘), {
application: me,
id: name
});
this.controllers.add(controller);
if (me._initialized) {
controller.doInit(me);
}
}
};