Zoom function screws up map display

Discussion created by thek04 on Aug 30, 2013
Latest reply on Sep 1, 2013 by vinaybansal
I've written a zoom function that is supposed to zoom to a point by creating a bounding box based on the coordinantes of the point. It attempts to zoom the new extent but it gives me an error and then the map resizes and layers redraw incorrectly at different scales.  The scale bar displays NaN instead of numbers.

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 =;
        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,

          if((graphic.attributes) && graphic.attributes.FID === clickedWell.FID){
            selectedWell = graphic.geometry;


Anyone have any ideas on what is going on and how to fix it?
My well layer I am using in my zoon function is in 4326 on the server but I am not sure about the others.