empicard

infoWindow vs infoTemplate

Discussion created by empicard on Apr 9, 2012
Latest reply on May 7, 2012 by empicard
Ive got a datagrid that lists the results of a query, which are shown as points in my map.
When you click on the datagrid, I'd like an infoWindow to open on the point.

I've set infoTemplate to open an infoWindow when a point is clicked.
var infoTemplate = new esri.InfoTemplate("Sales Rep: ${NAME}", ("${*}")); 
...
repGraphic.setInfoTemplate(infoTemplate);
map.graphics.add(repGraphic); 


this seems to be all that's necessary for clicking on the point.


I've also got a datagrid.
When you click on the grid, I want the same infoWindow to open, anchored at the point. 

At best, I get all the attributes, but formatted differently.
I would have thought just
map.infoWindow.show(selectedRepGraphic.geometry);


would be enough, as the template has already been set.
but no, I only get an empty window.

I've created a new InfoTemplate to see if that would make a difference, and, I've tried a million combinations of the following:

          var selInfoTemplate = new esri.InfoTemplate("Sales Rep: ${NAME}", ("${*}")); //"Rep # : ${rep_no}", "Address : ${ADDR1}");
            map.infoWindow.setTitle(selectedRepGraphic.getContent("${NAME}"));
            selectedRepGraphic.setInfoTemplate(selInfoTemplate);

            map.infoWindow.show(selectedRepGraphic.geometry);
            map.graphics.add(selectedRepGraphic); 


The first infoTemplate creates the infowWindow with {NAME} in bold in the title, the rest in a regular font, the second selInfoTemplate creates it all in bold.
Any clue why?

Outcomes