function makeZoomButton(id){//id is objectid
var zBtn = "<div data-dojo-type='dijit.form.Button'><img src='photos/bg_magnify.png'";
zBtn = zBtn + " width='18' height='18'";
zBtn = zBtn + " onClick=\"zoomRow('"+id+"')\"></div>"; //activates zoomRow function
return zBtn;
}
function zoomRow(id){
var grid = dijit.byId('grid');
var clickedWell = grid.getItem(id);
var selectedWell = map.graphics;
var distance = 1000;
var newExtent = new esri.geometry.Extent({
"xmin": selectedWell.x - distance,
"ymin": selectedWell.y - distance,
"xmax": selectedWell.x + distance,
"ymax": selectedWell.y + distance,
"spatialReference":{"wkid":4326}
});
console.log(map.graphics.graphics);
dojo.forEach(map.graphics.graphics,function(graphic){
console.log(graphic);
if((graphic.attributes) && graphic.attributes.FID === clickedWell.FID){
selectedWell = graphic.geometry;
return;
}
});
map.setExtent(newExtent);
}
function zoomRow(id){
var grid = dijit.byId('grid');
var clickedWell = grid.getItem(id);
var selectedWell = null;
dojo.forEach(map.graphics.graphics,function(graphic){
if((graphic.attributes) && graphic.attributes.FID === clickedWell.FID){
selectedWell = graphic.geometry;
return;
}
});
if(selectedWell != null){
var distance = 1000;
var newExtent = new esri.geometry.Extent({
"xmin": selectedWell.x - distance,
"ymin": selectedWell.y - distance,
"xmax": selectedWell.x + distance,
"ymax": selectedWell.y + distance,
"spatialReference":{"wkid":4326}
});
map.setExtent(newExtent);
}
}
function zoomRow(id){
var grid = dijit.byId('grid');
var clickedWell = grid.getItem(id);
var selectedWell = null;
var graphic = null;
for(var iGraphicCnt =0; iGraphicCnt < map.graphics.graphics.length;iGraphicCnt++)
{
graphic = map.graphics.graphics[iGraphicCnt];
if((graphic.attributes) && graphic.attributes.FID === clickedWell.FID){
selectedWell = graphic.geometry;
break;
}
}
if(selectedWell != null){
var distance = 1000;
var newExtent = new esri.geometry.Extent({
"xmin": selectedWell.x - distance,
"ymin": selectedWell.y - distance,
"xmax": selectedWell.x + distance,
"ymax": selectedWell.y + distance,
"spatialReference":{"wkid":4326}
});
map.setExtent(newExtent);
}
}