When I select a geometry on map, the method map.infoWindow.getSelectedFeature() always returns "undefined". This behaviour is not working code below:
map = new Map("mapDiv", {});
map.infoWindow.on("selection-change", function ()
{ var graphic = map.infoWindow.getSelectedFeature(); // graphics is always "undefined" }
How to get the currently selected feature ?
Thank you!
Solved! Go to Solution.
esri user,
Because you are creating a new map and not trying to use the existing map you will never get a selection. You need to use the existing map object:
this.map.infoWindow.on("selection-change", function (){
var graphic = this.map.infoWindow.getSelectedFeature(); // graphics is always "undefined"
}
esri user,
Because you are creating a new map and not trying to use the existing map you will never get a selection. You need to use the existing map object:
this.map.infoWindow.on("selection-change", function (){
var graphic = this.map.infoWindow.getSelectedFeature(); // graphics is always "undefined"
}
Do you need to use lang.hitch here?
this.map.infoWindow.on("selection-change", lang.hitch(this, function (){
var graphic = this.map.infoWindow.getSelectedFeature(); // graphics is always "undefined"
}));