lorenmueller

dojo namespace change upsets loading of local modules

Discussion created by lorenmueller on Aug 18, 2010
Latest reply on Nov 2, 2010 by rollinsio
Hi,
I can't get local modules to reload anymore with the namespace change.  In the code below I can not get into init_2 (I get cross-domain loading errors), though the in-line dijit is created just fine.  Hoping you can see where I have gone wrong without having to create your own test utility resource to try this one out.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>(esriDojo Testing)</title> 
   
    <!-- styling -->
    <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.0/js/dojo/dijit/themes/tundra/tundra.css"/>
                                
    <!-- Set dojo configuration -->
    <script type="text/javascript">
        djConfig = {
            isDebug: true,
            parseOnLoad: true,
            xdWaitSeconds: 10,
            scopeMap: [
                ["dojo", "esriDojo"],
                ["dijit", "esriDijit"],
                ["dojox", "esriDojox"]
            ],
            baseUrl: "./",
            modulePaths: {
                "MyModules": "./MyModules"
            }
        };
    </script>
   
    <!-- v2.0 uses Dojo v1.4.2 -->
    <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.0"></script>
   
    <script type="text/javascript">
       
        esriDojo.require("dijit.form.DropDownButton");
        esriDojo.require("dijit.Menu");
        esriDojo.addOnLoad(init_1);
       
        function init_1() {
            console.log("in init_1()");
            esriDojo.require("MyModules.Utilities.MyTestUtility");
            esriDojo.addOnLoad(init_2);
        }
       
        function init_2(){
            console.log("in init_2()");
        }

    </script>
   
</head>
<body class="tundra">
   
    <button esriDojoType="dijit.form.DropDownButton">
    <span>Test DDBtn</span>
    <div esriDojoType="dijit.Menu">
        <div esriDojoType="dijit.MenuItem" label="Some menu item 1">
            <script type="dojo/method" event="onClick" args="evt">
                console.log("ok 1");
            </script>
        </div>
        <div esriDojoType="dijit.MenuItem" label="Some menu item 2">
            <script type="dojo/method" event="onClick" args="evt">
                console.log("ok 2");
            </script>
        </div>                  
    </div>
    </button>

</body>
</html>


Loren

Outcomes