[CLOSED] which Ext.onReady gets executed first?

  1. #1

    [CLOSED] which Ext.onReady gets executed first?

    In the example you guys did for me ( Coolite.Sandbox\Temp\UpdatePanel\PeterNamespace ) I'm wondering if it is guaranteed to work if I follow this pattern. There are two Ext.onReady()'s now. One generated by coolite, and one in the default.js file. It seems that the order of execution is not dependent on the order the js files are included. If this is true, how can I force the external js file to run after the code.

    It seems like I should be coding an event or something in my scriptmanager that executes some code at the end of the generated javascript that goes out and runs my code in the js file. If so, how can I call a function at the end of my generated script?

    I'm trying to figure this out on my own and am not sure where to look. Can you also point me at where I might find this? Thanks..
  2. #2

    RE: [CLOSED] which Ext.onReady gets executed first?

    Not sure if this is what u r looking for but here's how I handle it:

    MasterPage where ScriptManager is defined:
        <ext:ScriptManager ID="extScriptMgr" runat="server">
            <Listeners>
                <DocumentReady Handler="Ext.Msg.minWidth = 200; if (window.OnExtReady) {OnExtReady();}" />
            </Listeners>
        </ext:ScriptManager>
    ContentPage external js file:
    function OnExtReady() {
       // do something.  this function executed AFTER Coolite's generated scripts 
    }
  3. #3

    RE: [CLOSED] which Ext.onReady gets executed first?

    Hi Peter,

    The onReady functions are fired in the order in which they are called... basically, the order in which they appear in the code. If onReady block "A" is loaded/called before onReady block "B", then "A" will execute before "B".


    I hope this helps answer your question.


    Geoffrey McGill
    Founder
  4. #4

    RE: [CLOSED] which Ext.onReady gets executed first?

    Ok, thanks.
  5. #5

    RE: [CLOSED] which Ext.onReady gets executed first?

    Hi jchau,

    The only scenario I can think of where your OnExtReady function would be required is if your external .js file ( <script> ) which contained the OnExtReady function was loaded before the required extjs and coolite toolkit scripts.

    If that's the case, then you might want to test placing an <ext:ScriptContainer> into the <head> of your Page. If a ScriptContainer is present, the ScriptManager will render the script and style includes into the location of the ScriptContainer.

    Example

    <head id="Head1" runat="server">
        <title>Untitled Page</title>
        <ext:ScriptContainer ID="ScriptContainer1" runat="server" />
        <script type="text/javascript" src="/your/file/here.js"></script>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ScriptManager ID="ScriptManager2" runat="server" />
        </form>
    </boody>
    If your .js file is added after the toolkit rendered <script>'s, then you should only have to add your logic within the Ext.onReady() function.

    Hope this helps.

    Geoffrey McGill
    Founder

Similar Threads

  1. [CLOSED] Rowselection is executed when Selecting a Grid cell
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 09, 2011, 9:13 AM
  2. Replies: 3
    Last Post: Apr 14, 2011, 1:24 AM
  3. Ext.onReady,userControl and ComboBox
    By dukeucha in forum 1.x Help
    Replies: 1
    Last Post: Jun 14, 2010, 6:53 AM
  4. [CLOSED] [1.0] How to add client script in before OnReady?
    By bsnezw in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 14, 2010, 10:56 AM
  5. Replies: 7
    Last Post: Nov 11, 2008, 3:59 AM

Posting Permissions