agesriuser

setExtent: need to execute twice

Discussion created by agesriuser on Jun 11, 2012
Latest reply on Jun 16, 2012 by CMahlke-esristaff
We have a function for zooming to a saved extent that only works when executed a second time:

function setMapExtentESRI(xMin, yMin, xMax, yMax) {
var sr = new esri.SpatialReference({wkid: 1337}); /* where 1337 is a well-known ID */
var extent = new esri.geometry.Extent(xMin, yMin, xMax, yMax, sr); /*
esrimap.setExtent(extent);
}


The first time this exact code is executed, the map moves to the correct extent but disappears. The second time this code is executed with the same parameters, with no other code executing in the meantime, the map appears at that extent.

Running API version 2.5.  Tried 2.7 with the same results.

Outcomes