Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: HELP ! app is undefined, app is application name

  1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    1
    Vote Rating
    0
      0  

    Default HELP ! app is undefined, app is application name

    Ext.application({
    name: 'app',
    launch: function(){
    console.log(app);
    }
    });


    console: app is undefined

  2. #2
    Sencha User SunboX's Avatar
    Join Date
    Mar 2010
    Posts
    238
    Vote Rating
    28
      0  

    Exclamation

    You have to add a Controller!

    Code:
    Ext.Loader.setConfig({ enabled: true });
    
    Ext.application({
        name: 'App',
        
        // the controller will take care of creating the view        
        controllers: ['AppController'],
        
        launch: function() {              
            console.log('app launch');
            console.log(App);
        }
    });
    greetings Sunny

  3. #3
    Sencha User jep's Avatar
    Join Date
    Sep 2010
    Posts
    862
    Vote Rating
    24
      0  

    Default

    I think part of the confusion is that the docs haven't yet been updated for that.

  4. #4
    Sencha User jep's Avatar
    Join Date
    Sep 2010
    Posts
    862
    Vote Rating
    24
      0  

    Default

    Also, when I run your code with 2.0 pr 1, I get:

    Uncaught Error: [Ext.Loader] Failed loading 'app/controller/AppController.js', please verify that the file exists

    So no idea how this is all supposed to work.

  5. #5
    Sencha User SunboX's Avatar
    Join Date
    Mar 2010
    Posts
    238
    Vote Rating
    28
      0  

    Default

    Heres a simple "Helleo World" example:

    https://github.com/FrancisShanahan/S...2MVCHelloworld

    greetings Sunny

  6. #6
    Sencha User jep's Avatar
    Join Date
    Sep 2010
    Posts
    862
    Vote Rating
    24
      0  

    Default

    That's one of the most complicated "Hello World" examples I've ever seen.

    I really hope this isn't what is expected of a "simple" Sencha app. If so, this is a big departure from previous versions. I think the whole MVC thing is overkill in many applications.

    FYI, here's how I would work around the app variable not being defined in the original example:

    Code:
    Ext.application({
      name: 'app',
      launch: function(){
        app = this;
        console.log(app);
      }
    });

  7. #7
    Sencha User SunboX's Avatar
    Join Date
    Mar 2010
    Posts
    238
    Vote Rating
    28
      0  

    Default

    In my opinion it's easy. Even small Apps will benefit from this MVC architecture. You can't get an app without a bit of work and learning. ;o)

    greetings Sunny

  8. #8
    Sencha User jep's Avatar
    Join Date
    Sep 2010
    Posts
    862
    Vote Rating
    24
      0  

    Default

    I think you've entirely missed the point of a "hello, world" app. If this is the "simple" way to learn ST, it's use will become much more limited and it will wither on the vine.

    Luckily, I don't believe that is the case. MVC is simply not always appropriate. If it was, nobody would ever create stuff that wasn't MVC.

  9. #9
    Sencha User SunboX's Avatar
    Join Date
    Mar 2010
    Posts
    238
    Vote Rating
    28
      0  

    Default

    Yes, there are non MVC Apps inside the example folder of the ST2-PR1 download. But if you get it working, you should think of MVC. It's difficult at the beginning but will get easier the more complex your app get's.

    Greetings Sunny

  10. #10
    Sencha User jep's Avatar
    Join Date
    Sep 2010
    Posts
    862
    Vote Rating
    24
      0  

    Default

    The problem isn't that there are no non-MVC examples. The problem is, as stated in the original post, Ext.application seems to not be filling in the "name" field with the object instance as it did prior to 2.0. I think this is probably an oversight (at least in non-MVC apps).

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •