Select to view content in your preferred language

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

714
1
Jump to solution
08-20-2013 01:38 AM
TatianaTen
Deactivated User
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,
0 Kudos
1 Solution

Accepted Solutions
TatianaTen
Deactivated User
Hi,

Answering my own issue.

I was able to manage the multiple selection on map click with createMap from Webmap json. The problem was that the map creation process also created a click handler on the map, switch, I believe, have instructions to clear the map on click. So, found it and removed it. Now selection works as expected.

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

View solution in original post

0 Kudos
1 Reply
TatianaTen
Deactivated User
Hi,

Answering my own issue.

I was able to manage the multiple selection on map click with createMap from Webmap json. The problem was that the map creation process also created a click handler on the map, switch, I believe, have instructions to clear the map on click. So, found it and removed it. Now selection works as expected.

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