chyang0107

graphic.attributes is not defined

Discussion created by chyang0107 on Aug 19, 2013
Latest reply on Aug 19, 2013 by DSwingley-esristaff
Hi Everyone,

I tried to modify the example listed below to zoom in the graphic. However, the Error Console keeps to tell me that is a error "TypeError: graphic.attributes is undefined" in the test with the red color. Please let me know if you can help point out the question.

Many thanks,

Hank

The example (StateZoomin): http://serverapps.esri.com/javascript_examples/StateZoom.html

My application: http://granite.nmt.edu/~hyang/test1.html
(Please use this link to see the source code)


function zoomRow(id){
selectionLayer.clear();
dojo.some(map.graphics.graphics,function(graphic){
if (graphic.attributes.OBJECTID.toString() === id) {
var selectedState = new esri.Graphic(graphic.geometry).setAttributes(
graphic.attributes);
selectionLayer.add(selectedState);
//Zoom to the extent of the parcel - expand it a bit so we aren't zoomed in too close.
var stateExtent = selectedState.geometry.getExtent();
map.setExtent(stateExtent);
return true;
}
});
}

Outcomes