Select to view content in your preferred language

Adding esri/basemaps module breaks another module

3080
2
Jump to solution
09-09-2015 06:59 PM
GeorgieCassar
Frequent Contributor

I am starting with the ESRI Popup Sample script straight out of the box.  Nothing changed other than all http references are now https..

Here it is running from our web server.   https://ecouncil.portenf.sa.gov.au/mapping/InspectorLoc/esri-popup-sample.html

Now I try to alter it to do some extra things like defining my own basemap.

Here is the same code and all I have done is added "esri/basemaps",   in the require section.  Nothing more.

https://ecouncil.portenf.sa.gov.au/mapping/InspectorLoc/esri-popup-sample_moduleadded.html

It has caused the popup creation command to fail with an error  (using IE10)  : "SCRIPT438: Object doesn't support property or method 'create' "

This is the command where it breaks

var popup = new Popup({

            fillSymbol: fill,

            titleInBody: false

        }, domConstruct.create("div"));

Why would simply adding a module break another one ?  Is there a special order I have to list them ?

This is the order I have done it :

require([

        "esri/map",

        "esri/basemaps",

        "esri/dijit/Popup", "esri/dijit/PopupTemplate",

        "esri/layers/FeatureLayer",

        "esri/symbols/SimpleFillSymbol", "esri/Color",

        "dojo/dom-class", "dojo/dom-construct", "dojo/on",

        "dojox/charting/Chart", "dojox/charting/themes/Dollar",

        "dojo/domReady!"

      ], function(........

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Georgie,

  The most common mistake for JS API beginners is that they add a require and there vars do not match. You have to have your requires aligned with the vars in order. See line 12. You added the require but you never added the corresponding var

require([
  "esri/map",
  "esri/basemaps",
  "esri/dijit/Popup", "esri/dijit/PopupTemplate",
  "esri/layers/FeatureLayer",
  "esri/symbols/SimpleFillSymbol", "esri/Color",
  "dojo/dom-class", "dojo/dom-construct", "dojo/on",
  "dojox/charting/Chart", "dojox/charting/themes/Dollar",
  "dojo/domReady!"
  ], function(
  Map,
  esriBasemaps,
  Popup, PopupTemplate,
  FeatureLayer,
  SimpleFillSymbol, Color,
  domClass, domConstruct, on,
  Chart, theme
  )

I did not continue to check your code for other errors.

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Georgie,

  The most common mistake for JS API beginners is that they add a require and there vars do not match. You have to have your requires aligned with the vars in order. See line 12. You added the require but you never added the corresponding var

require([
  "esri/map",
  "esri/basemaps",
  "esri/dijit/Popup", "esri/dijit/PopupTemplate",
  "esri/layers/FeatureLayer",
  "esri/symbols/SimpleFillSymbol", "esri/Color",
  "dojo/dom-class", "dojo/dom-construct", "dojo/on",
  "dojox/charting/Chart", "dojox/charting/themes/Dollar",
  "dojo/domReady!"
  ], function(
  Map,
  esriBasemaps,
  Popup, PopupTemplate,
  FeatureLayer,
  SimpleFillSymbol, Color,
  domClass, domConstruct, on,
  Chart, theme
  )

I did not continue to check your code for other errors.

GeorgieCassar
Frequent Contributor

Thanks Robert,  Haven't used the Javascript API since it changed to AMD style.  I've learn't something today !

0 Kudos