iggz

What's the correct syntax for adding multiple operationalLayers?

Discussion created by iggz on Mar 2, 2013
Latest reply on Mar 5, 2013 by dcastano
I'm working off of a template and am trying to add multiple operationalLayers. I feel like I've tried every possible combination.

If I just add one layer, it works fine:

operationalLayers: [{
  type: "feature",
  url: "http://xxxxxx.com/arcgis/rest/services/xxx/xxx/FeatureServer/5",
  options: {
   id: "Fiber1",
   title: "Cable",
   opacity: 1.0,
   visible: true,
   infoTemplate: new esri.InfoTemplate(),
   mode: esri.layers.FeatureLayer.MODE_SNAPSHOT
  }
 }],


But when I try to add another, none of them load when I start the index.html:

operationalLayers: [{
  type: "feature",
  url: "http://xxxxxx.com/arcgis/rest/services/xxx/xxx/FeatureServer/5",
  options: {
   id: "Fiber1",
   title: "Cable",
   opacity: 1.0,
   visible: true,
   infoTemplate: new esri.InfoTemplate(),
   mode: esri.layers.FeatureLayer.MODE_SNAPSHOT
  }
  type: "feature",
  url: "http://xxxxxx.com/arcgis/rest/services/xxx/xxx/FeatureServer/4",
  options: {
   id: "Fiber2",
   title: "Junction",
   opacity: 1.0,
   visible: true,
   infoTemplate: new esri.InfoTemplate(),
   mode: esri.layers.FeatureLayer.MODE_SNAPSHOT
  }
 }],


What am I doing wrong here?

Thanks for any help.

Outcomes