Solved! Go to Solution.
//Add the marker to the map siteTemplate = new esri.InfoTemplate(title, info); /* //set attributes here */ attr = { SITE_NAME: site_name }; graphic = new esri.Graphic(point, icon, attr, siteTemplate); map.infoWindow.resize(500, 400); glayer.add(graphic);
The sample that btfou posted uses an InfoWindow.]
var dialog = new dijit.TooltipDialog({ style: 'position:absolute; width:100px;' }); dojo.style(dialog.connectorNode, 'display', 'none'); dialog.startup(); map.getLayer('points_glayer').enableMouseEvents(); map.getLayer('points_glayer').on('mouse-over', function (evt) { //set the content to your local well no field //dialog.setContent(evt.graphic.attributes.WELL_NO); dialog.setContent('Hi! I'm a tooltip'); dijit.popup.open({ popup: dialog, x: evt.pageX, y: evt.pageY }); }); map.getLayer('points_glayer').on('mouse-out', function (evt) { dijit.popup.close(dialog); });
graphic.setAttributes({ WELL_NO: the_well_no });
Incorrect. This sample uses a dijit/TooltipDialog with mouse-over and mouse-out events. Nothing to do with infoWindow.
This code listens for onMouseOver to display an InfoWindow when the mouse hovers over a graphic.
I noticed your points_glayer doesn't have attributes. When you create the graphics form your data source take the well number and add it as an attribute of the graphic like thisgraphic.setAttributes({ WELL_NO: the_well_no });
then you can use it to display as shown in commented part of the code above.
defineGraphicLayer("points_glayer", 1); var glayer = map.getLayer("points_glayer"); glayer.clear();
//Add the marker to the map siteTemplate = new esri.InfoTemplate(title, info); /* //set attributes here */ attr = { SITE_NAME: site_name }; graphic = new esri.Graphic(point, icon, attr, siteTemplate); map.infoWindow.resize(500, 400); glayer.add(graphic);