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

Thread: Ext.Msg doesnt appear to be part of my app.js after Cmd

  1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    93

    Default Ext.Msg doesnt appear to be part of my app.js after Cmd

    I am getting an error after i package my app via Cmd (3.1.2) that implies that Ext.msg doesnt exist -

    Uncaught TypeError: Cannot call method 'show' of undefined

    I assume that this is the issue because I have a button whose tap event calls Ext.Msg.show

    How do I ensure that Ext.Msg is included in my package?

  2. #2
    Sencha User
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,165

    Default

    In your dev project (before you build) are you using ext-dev.js in your index.html page? If so, are you seeing any synchronous load warnings when using your app - pressing the button that uses Ext.Msg?

  3. #3
    Sencha User
    Join Date
    Jun 2011
    Posts
    93

    Default

    i'm using the latest sencha touch.

    something else that was odd at the time this happened is that all the events that were on specifc panels stopped working. i then moved them all to the controller where things started working again. no idea if its related, but there it is.

    i dont see any warnings during the build... al green messages.

  4. #4
    Sencha User
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,165

    Default

    Without building the app and just working with the application in dev do you see any warnings / prompts in the console of your browser's dev tools?

  5. #5
    Sencha User
    Join Date
    Jun 2011
    Posts
    93

    Default

    no errors at all when developing, it only occurs when build via cmd. i built a small test case and can reproduce it, below is the app - again, runs fine in chrome, after a "sencha app build package ../build" the error will appear when viewing the resulting package.

    download the sample project here: http://www.neonix.net/sencha/ext_msg_test.zip

  6. #6

    Default

    Howdy,

    I just had this issue now, the problem is that you need to require Ext.MessageBox to get Ext.Msg to be included as part of the built app.js. So to the class where you use Ext.Msg add 'Ext.MessageBox' to the requires list and it should work.

  7. #7
    Sencha User
    Join Date
    Jun 2011
    Posts
    93

    Default

    thanks, that was it...

    I'm curious though, if I drag and drop a "Basic Function" from the toolbox onto a panel, and insert my Ext.Msg.Show() code the same issue will arise.... how do I "require" Ext.Message in that case?

  8. #8
    Sencha User
    Join Date
    Jun 2011
    Posts
    93

    Default

    Ah, ok... I just found Ext.require.... I added that line to the application launch and my second example mentioned above is working.

    I suppose then, just to tie this up, that that would be the normal thing to do - to insert Ext.require for the necessary class inside of application launch?

  9. #9
    Sencha User
    Join Date
    Jun 2011
    Posts
    93

    Default

    apologies for the one-off posts.... am experimenting on this end....

    seems to me that this

    Code:
    Ext.define('MyApp.views', {
        requires: ['Ext.MessageBox']
    });
    Works better than this (which doesn't work at all when building)

    Code:
    Ext.require('Ext.MessageBox');
    I can drag/drop basic Function Behaviors on to panels and add Ext.Msg.show()'s in that fashion - the first code example includes Ext.Msg during a build whereas the second doesn't, or at least doesn't appear to.

    Again... looking for best practices / advice, thanks in advance...

  10. #10
    Sencha User
    Join Date
    Oct 2009
    Location
    Portland OR
    Posts
    10

    Default

    I'm not sure if this has anything to do with it but I noticed that there is an extra space the class mapping in the bootstrap.js:

    Code:
    Ext.Loader.addClassPathMappings({
      " Ext.Msg": "ext/src/window/MessageBox.js",
      "Ext": "ext/src",
      "bb.Application": "app/application.js",
      "Ext.rtl.EventObjectImpl": "ext/src/rtl/EventObject.js",
      "bb": "app"
    });

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
  •