Displaying an info window for a selected graphic without click event to get anchor pt

329
1
08-16-2010 07:05 AM
by Anonymous User
Not applicable
Hi,

This is probably staring me in the face but can't seem to determine from the API how you would go about doing this. 

I have a datagrid that list my feature class attributes, enables me to select the record of interest & highlight on the map.  From here, i want an infowindow to automatically open (nil user interaction with the map); While i can get this to work for a point feature class (via the infoWindow.show()), i cannot get it to work for a polygon as infoWindow.show() is expecting a point for its anchor. Appreciate any tips on how to implement this type of behaviour.. Using JS API 1.6.

Regards

Brad
0 Kudos
1 Reply
ShaneCastlen
New Contributor
Just found your post while trying to do something similar. I already had a point so I just had to convert it to screen coordinates. In your case you might use the center of your polygon. So something like this:


var screenpoint = map.toScreen(polygon.getExtent().getCenter()));

map.infoWindow.show(screenpoint, map.getInfoWindowAnchor(screenpoint));

0 Kudos