elove

Highlight OnRowClick Feature on Map?

Discussion created by elove on Jan 17, 2012
Latest reply on Jan 19, 2012 by elove
Hello,

I have an application that displays the results of an Identify Task in a datagrid. I then utilize the OnRowClick Handler to zoom to the feature. I would like the feature that is being zoomed to from each row to be highlighted on the map. Any help would be greatly apprciated!! :)



 function onRowClickHandler(evt){ 


  
  }  if (searchType == "Surveys") { 
   var clickedTaxLotId = grid3.getItem(evt.rowIndex).DOCUMENT_N; 
   var selectedTaxLot; 
   dojo.forEach(map.graphics.graphics,function(graphic){ 
     if((graphic.attributes) && graphic.attributes.DOCUMENT_N === clickedTaxLotId){ 
    selectedTaxLot = graphic; 
    //added this part to build infotemplate
     map.infoWindow.setTitle(graphic.getTitle()); 
     map.infoWindow.setContent(graphic.getContent());
                            return; 
     } 
        }); 
  
   if ( selectedTaxLot.geometry.declaredClass == 'esri.geometry.Point' ) {
   map.centerAndZoom(taxLotExtent, 11)
                                      var sp = map.toScreen(selectedTaxLot.geometry);
   map.infoWindow.show(selectedTaxLot.geometry, map.getInfoWindowAnchor(sp));
   } else {
   //alert("Polygon");
   var taxLotExtent = selectedTaxLot.geometry.getExtent(); 
   var screenpoint = map.toScreen(selectedTaxLot.geometry.getExtent().getCenter());
   var mappoint = map.toMap(screenpoint);
    map.setExtent(taxLotExtent,true);
   map.infoWindow.show(taxLotExtent.getCenter(), map.getInfoWindowAnchor(screenpoint));
   }
  
  
 } else if (searchType == "PointName") { 
   var clickedTaxLotId = grid4.getItem(evt.rowIndex).POINT_NAME; 
   var selectedTaxLot; 
   var highlightSymbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([25,50,225,0.3])); 
   dojo.forEach(map.graphics.graphics,function(graphic){ 
     if((graphic.attributes) && graphic.attributes.POINT_NAME === clickedTaxLotId){ 
    selectedTaxLot = graphic; 
    //added this part to build infotemplate
     map.infoWindow.setTitle(graphic.getTitle()); 
     map.infoWindow.setContent(graphic.getContent());
    return; 
     } 
        }); 
  
   if ( selectedTaxLot.geometry.declaredClass == 'esri.geometry.Point' ) {
   map.centerAndZoom(selectedTaxLot.geometry, 11)
   var sp = map.toScreen(selectedTaxLot.geometry);
   map.infoWindow.show(selectedTaxLot.geometry, map.getInfoWindowAnchor(sp));
   } else {
   //alert("Polygon");
   var taxLotExtent = selectedTaxLot.geometry.getExtent(); 
   var screenpoint = map.toScreen(selectedTaxLot.geometry.getExtent().getCenter());
   var mappoint = map.toMap(screenpoint);
    //map.centerAt(mappoint);
    map.centerAndZoom(selectedTaxLot.geometry,15);
   
   map.infoWindow.show(taxLotExtent.getCenter(), map.getInfoWindowAnchor(screenpoint));
   }
                                    }
                                 }

]

Outcomes