1. #1
    Ext User
    Join Date
    May 2010
    Posts
    2
    Vote Rating
    0
    foxofinfinety is on a distinguished road

      0  

    Question calling windows/dialogs made in an external JS file?

    calling windows/dialogs made in an external JS file?


    I'm stating to be able to use Ext, but I want to put the code in a seperate file.
    but, I don't know how to call the things I made in the external file.

    I made this warning with shows up as soon as one gets on the page:
    Code:
    Ext.MessageBox.show({
                        title: 'Message from Adminestrator',
                        msg: 'please note this is a beta version of {site}.<br> not all features are working.<br> we are doing our best to make the site fully functional as soon as we can.',
                        buttons: Ext.MessageBox.OK,
                        animEl: 'page_body',
                        icon: Ext.MessageBox.WARNING
                    });
    and this works, but only when it's indeed inline in the main file, like this.

    the problem is, how do I get this in a external JS file, in such A way it works, and I can call it, I tried this:
    Code:
    var betaMessage = new Ext.MessageBox({
        title: 'Message from Adminestrator',
        msg: 'please note this is a beta version of {site}.<br> not all features are working.<br> we are doing our best to make the site fully functional as soon as we can.',
        buttons: Ext.MessageBox.OK,
        animEl: 'page_body',
        icon: Ext.MessageBox.WARNING
    });
    and then tried calling it like this:
    Code:
    betaMessage.show();
    which does nothing.
    I know it's wrong (else it would have worked) but I have not the slightest idea of what it should be.

    (in the code {site} is the name of the site, but it's not relevant so, not to spam the forums, I replaced it with a place holder for here)

  2. #2
    Ext User
    Join Date
    May 2010
    Posts
    2
    Vote Rating
    0
    foxofinfinety is on a distinguished road

      0  

    Default


    never mind, found the problem.

    I tried making a variable with an object of type Ext.MessageBox, I should have just used the normal Ext.MessageBox.show() function and put that within a function, a.k.a. this:

    Code:
    function show_beta_warn(){
        Ext.MessageBox.show({
            title: 'Message from Adminestrator',
            msg: 'please note this is a beta version of <site>.<br> not all features are working.<br> we are doing our best to make the site fully functional as soon as we can.',
            buttons: Ext.MessageBox.OK,
            animEl: 'page_body',
            icon: Ext.MessageBox.WARNING
        });
    };
    and then call that function like I would if it was in the main file....

Similar Threads

  1. calling external javascript
    By avilanchee in forum Ext GWT: Help & Discussion (1.x)
    Replies: 0
    Last Post: 17 Feb 2010, 10:29 PM
  2. Calling grid as template from external js file
    By l_aron in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 18 Aug 2009, 1:19 PM
  3. Calling a grid defined in an external JS file
    By tlili in forum Ext 3.x: Help & Discussion
    Replies: 9
    Last Post: 22 Jul 2009, 6:26 AM
  4. Speed up displaying Modal Windows (Dialogs)
    By Nagiy in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 26 Jun 2009, 1:19 PM