You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the latest CMV, if I have a 'feature'-type layer and a 'dynamic'-type layer, and use the Identify widget's dropdown to specify only the dynamic layer, I'll still get the feature layer when I go to identify something.
Alternatively, if I choose the feature layer from the dropdown and identify a feature, I'll get the same twice.
What appears to be happening is that the feature layer's graphic gets selected, line 215-227 of Identify.js, and then it gets added to the list of layers to be identified again around line 238-248.
If all my layers are dynamic, it seems to work as intended.
What should the widget be doing?
I needed it to not care whether the layers were feature or dynamic, and I ended up fixing these issues by adding the checks to executeIdentifyTask and the helper function below to Identify.js. Here are those fixes if it's useful to anyone else... there may be cleaner ways to do this but it seems to be working. I'll submit a pull request if the main CMV people think it'd be appropriate.
Thanks
executeIdentifyTask: function(evt){varmapPoint=evt.mapPoint;varidentifyParams=this.createIdentifyParams(mapPoint);varidentifies=[];varidentifiedlayers=[];varselectedLayer=this.getSelectedLayer();if(!this.checkForGraphicInfoTemplate(evt)){// return;varlayer=array.filter(this.layers,function(l){returnl.ref.id===evt.graphic._layer.id;})[0];if(!layer){return;}if(selectedLayer==='***'||layer.ref.id===selectedLayer.split('||')[0]){//added by meidentifiedlayers.push(layer);vard=newDeferred();identifies.push(d.promise);d.resolve([{feature: evt.graphic}]);}//added by me}this.map.infoWindow.hide();this.map.infoWindow.clearFeatures();// don't identify on shift-click, ctrl-click or alt-clickif(evt.shiftKey||evt.ctrlKey||evt.altKey){return;}array.forEach(this.layers,lang.hitch(this,function(lyr){varlayerIds=this.getLayerIds(lyr,selectedLayer);if(layerIds.length>0){if(!this.doesLayerExistInLayerList(lyr,identifiedlayers)){//added by mevarparams=lang.clone(identifyParams);params.layerDefinitions=lyr.ref.layerDefinitions;params.layerIds=layerIds;if(lyr.ref.timeInfo&&lyr.ref.timeInfo.timeExtent&&this.map.timeExtent){params.timeExtent=newTimeExtent(this.map.timeExtent.startTime,this.map.timeExtent.endTime);}identifies.push(lyr.identifyTask.execute(params));identifiedlayers.push(lyr);}//added by me}}));if(identifies.length>0){this.map.infoWindow.setTitle(this.i18n.mapInfoWindow.identifyingTitle);this.map.infoWindow.setContent('<div class="loading"></div>');this.map.infoWindow.show(mapPoint);all(identifies).then(lang.hitch(this,'identifyCallback',identifiedlayers),lang.hitch(this,'identifyError'));}},// function added by medoesLayerExistInLayerList: function(layer,layerList){varfoundDuplicate=false;varlayerIdToCheck=layer.ref.id;array.forEach(layerList,function(lyr){if(lyr.ref.id===layerIdToCheck||foundDuplicate){foundDuplicate=true;}});returnfoundDuplicate;},
The text was updated successfully, but these errors were encountered:
Using the latest CMV, if I have a 'feature'-type layer and a 'dynamic'-type layer, and use the Identify widget's dropdown to specify only the dynamic layer, I'll still get the feature layer when I go to identify something.
Alternatively, if I choose the feature layer from the dropdown and identify a feature, I'll get the same twice.
What appears to be happening is that the feature layer's graphic gets selected, line 215-227 of Identify.js, and then it gets added to the list of layers to be identified again around line 238-248.
If all my layers are dynamic, it seems to work as intended.
What should the widget be doing?
I needed it to not care whether the layers were feature or dynamic, and I ended up fixing these issues by adding the checks to executeIdentifyTask and the helper function below to Identify.js. Here are those fixes if it's useful to anyone else... there may be cleaner ways to do this but it seems to be working. I'll submit a pull request if the main CMV people think it'd be appropriate.
Thanks
The text was updated successfully, but these errors were encountered: