Map InfoWindow Issue

346
2
Jump to solution
04-29-2020 02:54 AM
KafilBaig
New Contributor III

In my custom widget i have a datagrid and on row click i am showing the location and infowindow on map. For Point the infowindow shows correctly but for polygon unless i click on map and then click on dgrid it wont show . Please guide me if am doing something wrong. Please find the code below.

Var polysymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_NULL, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0,255,0]), 5), new Color([255,255,0,0.25]));

var clickPointGraphics = new Graphics(featureSet.features[0].geometry, polysymbol);

clickPointGraphics.setInfoTemplate(InfoTemplate);

this.map.graphics.add(clickPointGraphics);

this.map.infoWindow.SetTitle(title);

this.map.infoWindow.SetContent(Content);

this.map.infoWindow.show(featureSet.features[0].geometry, this.map.getInfoWindowAnchor(featureSet.features[0].geometry));

var stateExtent = featureSet.features[0].geometry.getExtent().expand(5.0);

this.map.setExtent(stateExtent);

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Kafil,

  The 

this.map.infoWindow.show(featureSet.features[0].geometry, this.map.getInfoWindowAnchor(featureSet.features[0].geometry));

Is expecting a point Not a polygon so your code would have to look like this:

this.map.infoWindow.show(featureSet.features[0].geometry.getCentroid(), this.map.getInfoWindowAnchor(featureSet.features[0].geometry.getCentroid()));

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Kafil,

  The 

this.map.infoWindow.show(featureSet.features[0].geometry, this.map.getInfoWindowAnchor(featureSet.features[0].geometry));

Is expecting a point Not a polygon so your code would have to look like this:

this.map.infoWindow.show(featureSet.features[0].geometry.getCentroid(), this.map.getInfoWindowAnchor(featureSet.features[0].geometry.getCentroid()));
0 Kudos
KafilBaig
New Contributor III

Thanks Robert for your help. It worked.

0 Kudos