AnsweredAssumed Answered

SELECTION_ADD doesn't work when I use esri.argis.utils.CreateMap with webmap json

Question asked by TatianaTen on Aug 20, 2013
Latest reply on Aug 22, 2013 by TatianaTen
Hello,

I'm having a grief over my selection tool. :( The problem between working and not working selection is the way the map is created.
So, if I use
this.map = new esri.Map("map", {                slider: false             });               var basemap = new esri.layers.ArcGISTiledMapServiceLayer(url);             this.map.addLayer(basemap);  var featureLayer = new esri.layers.FeatureLayer(url, {                     mode: FeatureLayer.MODE_ONDEMAND                 });                   this.map.addLayer(featureLayer);                       //when the map is clicked create a buffer around the click point of the specified distance.                 var sr = this.map.spatialReference;                 this.map.on("click", function (evt) {                     var query = new Query();                     var extent = new esri.geometry.Extent(evt.mapPoint.x - 20, evt.mapPoint.y - 20, evt.mapPoint.x + 20, evt.mapPoint.y + 20, sr);                     query.geometry = extent;                     query.spatialRelationship = Query.SPATIAL_REL_INTERSECTS;                     featureLayer.selectFeatures(query, FeatureLayer.SELECTION_ADD);                 });


SELECTION_ADD works as expected, BUT... If I use the following to create my map

utils.createMap(this.webmap, "map", {mapOptions: this.mapOptions}).then(dojo.hitch(this, function (response) {                     this.map = response.map;                 }));


SELECTION_ADD doesn't work as expected, it selects one feature at the time, i.e. acts as SELECTION_NEW.

I would appreciate any help, any suggestions posted.

Thanks in advance.

Regards,

Outcomes