Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Web applications 有没有办法获取ExtJS 4.0应用程序中的所有控制器_Web Applications_Extjs_Extjs4 - Fatal编程技术网

Web applications 有没有办法获取ExtJS 4.0应用程序中的所有控制器

Web applications 有没有办法获取ExtJS 4.0应用程序中的所有控制器,web-applications,extjs,extjs4,Web Applications,Extjs,Extjs4,我正在使用ExtJS4.0的新MVC架构构建一个应用程序。我正在寻找一种方法来迭代应用程序中的所有控制器。下面我放了一些示例代码,让大家了解我正在尝试做什么 Ext.application({ name: 'MyApp', appFolder: '/App', controllers: [ 'HdMenuItemsController' ], launch: function () { //This works:

我正在使用ExtJS4.0的新MVC架构构建一个应用程序。我正在寻找一种方法来迭代应用程序中的所有控制器。下面我放了一些示例代码,让大家了解我正在尝试做什么

Ext.application({
    name: 'MyApp',
    appFolder: '/App',
    controllers: [
        'HdMenuItemsController'
    ],
    launch: function () {
        //This works:
        this.getController('HdMenuItemsController')

        //I want to do something like this:
        this.controllers.each(myFunction);

        //or this:
        this.getAllControllers().each(myFunction);

        //or this:
        Ext.getControllersForApp(this).each(myFunction);


        }
    });

据我所知,没有内置的方式(我有点好奇为什么需要这样做),但您可以按如下方式完成此操作(如示例中所示,将其放入
launch()
函数中):


据我所知,没有内置的方式(我有点好奇为什么需要这样做),但您可以按如下方式完成此操作(如示例中所示,将其放入
launch()
函数中):

this.controllers.each(function(item, index, length){
    var myController = this.getController(item.id);
    //now do something with myController!

    //OR:
    this.getController(item.id).someFunction();
    //where someFunction() is defined in all of your controllers
});