AnsweredAssumed Answered

Identify: Do not return unless Layer defined in popup config

Question asked by rogers259 on May 23, 2014
Latest reply on May 27, 2014 by rogers259
I'm having an issue with click identify returning results when not defined in the config popup file. I can get the popup to return if undefined, and it returns all fields. However I need it to return nothing unless its defined in the conf file.

Here's the portion of code that i'm working with, as is it works correctly for defined ...but we need to change the undefined to return nothing at all and currently its returning all fields.

        identifyCallback: function(identifiedlayers, responseArray) {             var fSet = [];             array.forEach(responseArray, function(response, i) {                 var layerId = identifiedlayers[i].ref.id;                 array.forEach(response, function(result) {                     // see if we have a Popup config defined for this layer                     if (config.hasOwnProperty(layerId)) {                         if (config[layerId].hasOwnProperty(result.layerId)) {                             result.feature.setInfoTemplate(new PopupTemplate(config[layerId][result.layerId]));                         }                     }                     // if no Popup defined output all attributes                     if (result.feature.infoTemplate === undefined) {                         result.feature.setInfoTemplate(new PopupTemplate({                             title: result.layerName,                             description: esriLang.substitute(result.feature.attributes)                         }));                     }                     fSet.push(result.feature);                 }, this);             }, this);             this.map.infoWindow.setFeatures(fSet);         }


Thanks for the help...this ones got me pretty perplexed.

Outcomes