I have a nice JSAPI app that incorporates search and locate widgets and an identify task (thank you Robert Scheitlin for your help!) When I try to add a Layer List widget with a group layer the identify task fails and my search widget disappears. It appears that I don't even need the widget (notice the commented out layer list code) as creating the group layer already adds this to my map. Therefore the Group Layer seems to be what's messing things up. I've attached the older code that works (version 247) and the code with the added group layer(347) as my ultimate goal is to allow users a choice of several map services to view as a basemaps. Any help out there?
Solved! Go to Solution.
Douglas,
What I see right off in your browser347.html is your requires and subsequent vars are misaligned:
(line 6 was moved to match the order of your var names); AMD style programming needs the require list to have a exact order matching list of vars in the function.
The abc’s of AMD | ArcGIS Blog
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/MapImageLayer",
"esri/layers/GroupLayer",
"esri/widgets/LayerList",
"esri/tasks/IdentifyTask",
"esri/tasks/support/IdentifyParameters",
"esri/widgets/Search",
"esri/widgets/Locate",
"dojo/_base/array",
"dojo/on",
"dojo/dom",
"dojo/domReady!"
], function(
Map, MapView, MapImageLayer, GroupLayer, LayerList,
IdentifyTask, IdentifyParameters, Search, Locate,
arrayUtils, on, dom
) {
Douglas,
What I see right off in your browser347.html is your requires and subsequent vars are misaligned:
(line 6 was moved to match the order of your var names); AMD style programming needs the require list to have a exact order matching list of vars in the function.
The abc’s of AMD | ArcGIS Blog
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/MapImageLayer",
"esri/layers/GroupLayer",
"esri/widgets/LayerList",
"esri/tasks/IdentifyTask",
"esri/tasks/support/IdentifyParameters",
"esri/widgets/Search",
"esri/widgets/Locate",
"dojo/_base/array",
"dojo/on",
"dojo/dom",
"dojo/domReady!"
], function(
Map, MapView, MapImageLayer, GroupLayer, LayerList,
IdentifyTask, IdentifyParameters, Search, Locate,
arrayUtils, on, dom
) {
Thanks! That along with a slight move in where I placed the previously commented out layer list code was all it took.