AnsweredAssumed Answered

Dynamic Map Service Popup not working after updating url

Question asked by ryandeng on Aug 16, 2018
Latest reply on Aug 16, 2018 by ryandeng

Hi, 

I have a dynamic map layer but for some reason once the widget update the variable "year_opSelect" which changes the url to a different map service, the popup stopped working. does anyone know why and how to fix it? Thanks so much!!

 

takeoutLayerFromMap: function (layer) {
   this.inherited(arguments);
   var layerToRemove = this.map.getLayer(layer);
   this.map.removeLayer(layerToRemove);
},

 

if (this.map.getLayer("hDynamicLayer") !== undefined) {
   this.takeoutLayerFromMap("hDynamicLayer");
};

 

var hYearUrlD = "https://randomtestsite.org:6443/arcgis/rest/services/appLayers/Application_" + year_opSelect + "/MapServer"

 

var hDynTemplate= {};
      hDynTemplate[0] = { infoTemplate: templateX };

 

var hDynamicLayer = new ArcGISDynamicMapServiceLayer(hYearUrlD, {id: "hDynamicLayer", minScale: hDetailMinVal,       imageformat: "png32", name: "h Application Details"});
      hDynamicLayer.setVisibleLayers([dSelect]);
      hDynamicLayer.setInfoTemplates(hDynTemplate);

 

var hLayerDefinitions = [];
      hLayerDefinitions[dSelect] = hYear_ID;

 

var hlayerDrawingOptions = [];
var layerDrawingOption = new LayerDrawingOptions();
      layerDrawingOption.renderer = hRenderer;
      hlayerDrawingOptions[dSelect] = layerDrawingOption;
      hDynamicLayer.setLayerDrawingOptions(hlayerDrawingOptions);
      hDynamicLayer.setLayerDefinitions(hLayerDefinitions);

 

this.map.addLayer(hDynamicLayer);

Outcomes