hi all,
i have highlighted a point based on selection using
SelectedFindDeceasedName.setSymbol(highlightSymbol);
how can u dehighlight the same before highlighting the other point feature
thanks,
satya
Satya,
So if the symbol321 is the NORMAL symbol then you need to apply that symbol to each other graphic.
dojo.forEach(map.graphics.graphics,function(graphic){ //deselect all graphics first SelectedFindDeceasedName.setSymbol(symbol321); if((graphic.attributes) && graphic.attributes.FID === FindDeceasedName){ SelectedFindDeceasedName = graphic; //Apply the highlight symbol to only the one that matches SelectedFindDeceasedName.setSymbol(highlightSymbol); return; } });
Hi Robert,
Thanks,
Satya.
Hi,
this is my code
initially set the symbol
symbol321 = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_SQUARE, 0.1, null, new Color([255, 255, 0, 0.5]));
function onRowClickHandler(evt){
var FindDeceasedName = grid.getItem(evt.rowIndex).FID;
var SelectedFindDeceasedName;
dojo.forEach(map.graphics.graphics,function(graphic){
if((graphic.attributes) && graphic.attributes.FID === FindDeceasedName){
SelectedFindDeceasedName = graphic;
SelectedFindDeceasedName.setSymbol(symbol321);
return;
}
});
var FindDeceasedNameExtent = SelectedFindDeceasedName.geometry;
var factor = 0.1;
var extent;
extent = new esri.geometry.Extent({ "xmin": FindDeceasedNameExtent.x - factor, "ymin": FindDeceasedNameExtent.y - factor, "xmax": FindDeceasedNameExtent.x + factor, "ymax": FindDeceasedNameExtent.y + factor, "spatialReference": { "wkid": 3857} });
map.setExtent(extent);
still previously highlighted is not cleared.
Regds,
Satya
check out this example: ArcGIS API for JavaScript Sandbox
they use a mouse-over event, first they clear all graphics and then they add a highlight graphic.
Tim
You just use setSymbol again on that feature again and apply the normal symbol. I would normally set a global var for the current selected symbol that way you know which one to apply the normal symbol to.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.