Cannot load a sub-module from Esri's dojo resources

835
1
08-28-2011 04:20 AM
EinatPickman
New Contributor
Hi,
My web application uses esri.map and esri.tasks.locator.
Whereas esri.map is loaded easily and works fine, the esri.tasks.locator causes an error message: "esri.tasks.Locator is not a constructor" at about 80% of the time.

I have downloaded esri 2.3 API, and I use it simultaneously with dojo 1.3.2. Here is my code:
<%-- Dojo 1.6 definitions --%>
<script type="text/javascript">
 djConfig = {
  jspiHost: "${pageContext.request.serverName}:${pageContext.request.serverPort}/EsriDojo/",
  baseUrl: "/EsriDojo/",
    scopeMap: [
      ["dojo","dojo16"],
      ["dijit","dijit16"],
      ["dojox","dojox16"],
    ],
    modulePaths: {
     "esri": "/EsriDojo/js/esri",         //this works great. I can call and initiate the map
     "esri.tasks" : "/EsriDojo/js/esri/tasks"     //this rarely works
    }
  };
</script>
<%-- Loading dojo 1.6 --%>
<script type="text/javascript" src="/EsriDojo/"></script>
<%-- Setting original dojo definitions back --%>
<script type="text/javascript">
 djConfig = dojo.config;
 dojo.registerModulePath("myCode","MyApp/js/myCode");  //my code. Works well too
</script>


I think the reason for this is a sub-module paths issue on dojo1.6 described here, yet I'm not sure because the suggested work-around doesn't work in my environment.

What do you think? Have you ever encountered such a problem?
I'd appreciate your help on that!
0 Kudos
1 Reply
JohnGrayson
Esri Regular Contributor
Is that all the code?  I'm not 100% sure, but I believe the error message alludes to an improper 'dojo.require(..)' statement.  I believe the letter 'l' is not capitalized:

dojo.require("esri.tasks.locator")


So my guess is that this difference is causing issues.  Try explicitly adding the dojo.require(...) above to see if it helps.
0 Kudos