简体   繁体   中英

ExtJs MVC Application won't load

I am currently trying to start an ExtJs MVC application that I created, integrated into another application. For unclear reasons it refuses to start, nor does it give any reasonable message as to why its happening, looking at the code below, I was able to determine that the init function runs to the end, but not the launch or beforeLaunch . Also Das.SubApp extends Ext.app.Controller .

   this.subApp = Ext.create('Das.SubApp', {
        appFolder: '/Scripts/app/das/FBrowser',
        name: 'FBrowser',
        controllers: ['BrowerController'],
        dependencies: {
            css: [],
            js: []
        },
        init: function() {console.log("initialized")},
        beforeLaunch: function() {
            console.log("Before launch");
        },
        launch: function () {
            console.log("launched library");
           }

Here is code from the BrowserController:

Ext.define('FBrowser.controller.BrowserController',{
extend: 'Ext.app.Controller',
views: ['browser.tree_dir',...],
stores: [...],
requires: ['FBrowser.Utilities'],

init: function() {

    this.control({..})

Anyone have any idea what could be wrong?

EDIT: Ok, so I seem to have found part of the issue, It appears that the application path isn't being set, I still don't understand why that is though, shouldn't the appFolder point to the right place?

This is quite easy;

Ext.app.Controller does not have

  • appFolder
  • name
  • beforeLaunch

and if you initialize it this way it wan't call the launch method cause this is all done or better said belongs to the Ext.app.Application Controller. Also note that you can only have one active Ext.app.Application instance or you will mess up the EventBus (override the bus of the first Ext.app.Application ). And even if you add these properties (appFolder, name) they do nothing at all cause the they are only used within the Ext.app.Application which is derived from Ext.app.Controller

The solution

Das.SubApp need to be Ext.app.Application (don't extend if not really needed cause you can have only one instance active anyway).

You may also be interested in this answer or this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM