Take a look at this site where a feature is highlighted from a grid. The feature can be highlighted by moving the mouse over the row in the grid or by clicking on the row. When the grid (dataGrid) is created, I add on listeners:
dataGrid.on(".dgrid-row:click", gridSelect);
dataGrid.on("show", function () {
dataGrid.resize();
});
dataGrid.on(mouseUtil.enterRow, gridEnter);
and these are the functions that highlight the grid. I put the highlight graphics into the map.graphics layer.
//this highlights the graphic
function gridEnter(e) {
map.graphics.clear();
var gridId = e.currentTarget.id;
var selectedGrid = dijit.byId(gridId);
var row = selectedGrid.row(e);
graphicHighlight = findGraphicByAttribute(row.data);
if (graphicHighlight !== null) {
switch (graphicHighlight.geometry.type) {
case "point": case "multipoint":
map.graphics.add(new esri.Graphic(graphicHighlight.geometry, symbolHighlightPoint));
break;
case "polyline":
map.graphics.add(new esri.Graphic(graphicHighlight.geometry, symbolHighlightPolyline));
break;
case "polygon": case "extent":
map.graphics.add(new esri.Graphic(graphicHighlight.geometry, symbolHighlightPolygon));
break;
}
}
}
//this "flashes" the graphic
function gridSelect(e) {
var graphicFlash;
var gridId = e.currentTarget.id;
var selectedGrid = dijit.byId(gridId);
var row = selectedGrid.row(e);
graphicHighlight = findGraphicByAttribute(row.data);
if (graphicHighlight !== null) {
switch (graphicHighlight.geometry.type) {
case "point": case "multipoint":
graphicFlash = new esri.Graphic(graphicHighlight.geometry, symbolFlashPoint)
break;
case "polyline":
graphicFlash = new esri.Graphic(graphicHighlight.geometry, symbolFlashPolyline);
break;
case "polygon": case "extent":
graphicFlash = new esri.Graphic(graphicHighlight.geometry, symbolFlashPolygon);
break;
}
map.graphics.add(graphicFlash);
}
var shape = graphicFlash.getDojoShape();
var animStroke = fx.animateStroke({
shape: shape,
duration: 500,
color: { end: new dojo.Color([0, 0, 0, 0]) }
});
var animFill = fx.animateFill({
shape: shape,
duration: 500,
color: { end: new dojo.Color([0, 0, 0, 0]) }
});
var anim = dojo.fx.combine([animStroke, animFill]).play();
var animConnect = dojo.connect(anim, "onEnd", function () {
map.graphics.remove(graphicFlash);
});
}
function findGraphicByAttribute(attributes) {
for (i = 0; i < layerResultsGraphic.graphics.length; i++) {
if (JSON.stringify(layerResultsGraphic.graphics.attributes) === JSON.stringify(attributes)) { return layerResultsGraphic.graphics; }
}
return null;
}