Displaying Outfields in something other than infowindow

516
2
02-14-2012 12:35 PM
LisaEidson
New Contributor III
I have a feature layer that I'm using to create a highligh-effect so that if a user mouses over a wilderness boundary, the boundary will highlight and the wilderness name will appear in an overlayed div. Unfortunately, all the examples I've seen write outfields to info windows and I can't seem to find the right syntax to simply output it in the innerHTML of a div. This really isn't a map question, per se, but I'd appreciate some guidance on syntax. I'm sure this will be a super easy question to answer...

http://www.wilderness.net/maptest_featurelayer.htm

Thanks much!
0 Kudos
2 Replies
KellyHutchins
Esri Frequent Contributor
Lisa,

You were really close in your app. The mouse over event for the wilderness outlines feature layer provides you access to the graphic via the event argument. From the graphc we can access the attributes by name (see example below).


  dojo.connect(featureOutlines, "onMouseOver", function(evt){ // listener for feature layer mouseovers; will add red outline onmouseover and remove it onmouseout
   var highlightGraphic = new esri.Graphic(evt.graphic.geometry,highlightSymbol);
   map.graphics.add(highlightGraphic);
   dojo.byId("wildName").innerHTML = evt.graphic.attributes.NAME;
  }); 
  

0 Kudos
LisaEidson
New Contributor III
That's the ticket, Kelly! Thanks much!
0 Kudos