multiple infowindows on map (java script API)

5628
9
12-19-2014 11:07 AM
NaveenKatta
New Contributor III

Hi,

I know its possible to do with flex api.

Is it possible to do same with javascript api? I am trying to add info window for each graphic as below.

map.infoWindow.setTitle(title);

map.infoWindow.setContent(content); 

map.infoWindow.show(graphic.geometry);

map.graphics.add(graphic);

it is adding for first graphic and if I try to add second graphic, the first graphic info window is deleting and it is adding to second graphic.

"The map is only allowed to have one info window (singleton design)."  is this statement true for java script api?

All answers are greatly appreciated..

Thanks.

0 Kudos
9 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Naveen,

   Yes there can only be one infoWindow in a map.

InfoWindow | API Reference | ArcGIS API for JavaScript

Note: Only one info window is displayed on the map at a time.

0 Kudos
NaveenKatta
New Contributor III

Robert,

Thanks for your quick reply. Is there any other way to show the graphic info on map for multiple graphics?

Thanks

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Naveen,

   Sorry I do not have any suggestions for this.

0 Kudos
HeikoHeijenga
Esri Contributor

Why do you want to show multiple popups? That's probably very confusing for the user. Can't you show all the graphics in one popup with arrows to let the user page through the graphics? This is ootb functionality of the esri/dijit/Popup widget.

0 Kudos
KenBuja
MVP Honored Contributor

Or show them in a grid like in this sample.

0 Kudos
NaveenKatta
New Contributor III

Heiko,

The application which is using flex API was in prod from couple of years and we don't want to change functionality while converting it to javascript API...I found one about popup...I will try below one..

https://community.esri.com/thread/101069

Thanks.

0 Kudos
NickCameron2
New Contributor III

Hi Naveen,

I had the same requirement...couldn't find anything so built a Popup subclass to allow multiple popups on a map and a few other things.

Just put it up on Github...I know this thread's pretty old but may help others looking for it as I came across this one while searching for a solution.

nickcam/PopupExtended · GitHub

shaylavi
Esri Contributor

Amazing work Nick! Have you managed to get it to work with feature services and layers from a webmap?

Based on your example, it seems to be working only for graphic layers at the moment.

Shay.

Shay
0 Kudos
NickCameron2
New Contributor III

Hey mate. Haven't looked at this in ages so had to refresh my memory . The demo is using a couple of feature layers and a graphics layers. Just try it out with any type of layer, it should work the same as a regular popup. Not sure about layers from a webmap though.

0 Kudos