Suffii
Suffii

Reputation: 5784

Issue on Loading Required Library With dojo

I have dojo js file and I have saved the ClusterLayer.js in all directories like

root --> ClusterLayer.js
root --> extras/ClusterLayer.js
root -->js/extras/ClusterLayer.js
root -->js/ClusterLayer.js

and the file is like

    require([
    "esri/map",
    "dojo/_base/array",
    "esri/layers/ArcGISDynamicMapServiceLayer",
    "esri/geometry/Geometry",
    "esri/geometry/Point",
    "esri/geometry/webMercatorUtils",
    "extras/ClusterLayer",
    "esri/graphic",
    "esri/symbols/SimpleMarkerSymbol",
    "esri/symbols/SimpleLineSymbol",
    "esri/symbols/SimpleFillSymbol",
    "esri/Color",
    "esri/InfoTemplate",
    "esri/dijit/HomeButton",
    "esri/dijit/OverviewMap",
    "dojo/parser",
    "esri/layers/GraphicsLayer",
    "esri/SpatialReference",
    "esri/dijit/PopupTemplate",

    "dijit/layout/BorderContainer", 
    "dijit/layout/ContentPane",
    "dojo/domReady!"
    ], function(Map, arrayUtils, ArcGISDynamicMapServiceLayer, Geometry, Point, webMercatorUtils, ClusterLayer, Graphic, SimpleMarkerSymbol, SimpleLineSymbol, SimpleFillSymbol, Color, InfoTemplate, HomeButton, OverviewMap,   parser, GraphicsLayer, SpatialReference, PopupTemplate)

but still getting error

enter image description here

Can you please let me know why this is happening?

Upvotes: 0

Views: 183

Answers (1)

Ken Franqueiro
Ken Franqueiro

Reputation: 10559

There is an ArcGIS tutorial that discusses doing exactly this. (Jump to step 4; apparently the link fragment doesn't navigate within the page correctly.)

I would note, though, that generally setting packages is preferable over paths, so instead of setting this:

paths: { extras: location.pathname.replace(/\/[^/]+$/, "") + "/extras" }

I would set this:

packages: [
    { name: "extras", location: location.pathname.replace(/\/[^/]+$/, "") + "/extras" }
]

(See also Dojo's CDN tutorial which explains basically the same situation.)

Both should roughly have the same effect in this case.

Upvotes: 1

Related Questions