Georgie.Cassar

Can I define different Infowindows on separate layers ?

Discussion created by Georgie.Cassar on Jun 19, 2011
Latest reply on Jul 6, 2011 by Georgie.Cassar
I have 2 map layers in the same map service representing different bus routes.  (Route 1 and Route 4)

My Aim: 
to display them on a map and when user hovers over Route 1, a range of attributes display in an infowindow.  When user hovers on Route 4, an info window displays containing a hyperlink to another page. 

My problem:
I can get Route 1 to work properly on hover.
When I try and apply an Infotemplate to Route 4, it exits the iteration of graphics (with no error).
I am wondering if there can only be one Infowindow defined per map ?????

I started with the sample called "Load query results and show on hover" http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jssamples_start.htm

This sumarises what I do:
Map is initialised, relevant layers added
When map is loaded, a function runs that defines a query for each route. Each with a callback function. The 2 Info Templates are defined also. 
Query of Route 1 is executed.  (and its associated callback)
Query of Route 4 is executed (and its associated callback)
(end of function.)

Each callback routine is a function that:
{
1. Defines a new graphic layer
2. Loops through the query result featureset graphics and for each one sets the relevant Infotemplate to the graphic and adds to a graphic layer.
3. Sets up an event listener for a Mouseover on that graphic layer that displays the map infowindow of the feature that has been hovered over.
}

All works well for Route 1 but after using lots of 'alerts' I find that Route 4 bombs out of the graphic iteration (in step 2 above) at the point of setting the infotemplate. 
ie.  othgraphic.setInfoTemplate(infoTemplateOther);    
No error appears.

Before I include any code, perhaps someone can tell me if I am trying to do something that is not possible.  In particular, can different info windows be defined for events on different map layers ? (simultaneously)

Outcomes