huttarl

setExtent() doesn't take effect

Discussion created by huttarl on May 4, 2010
Latest reply on Feb 11, 2011 by huttarl
Hi... I'm really puzzled and blocked by this one.
Here I have code in one of the map's onLoad event handlers, where I'm attempting to set the extent of the map based on params in the URL:

alert('setting extent according to url');
var newExtent = new esri.geometry.Extent(params.xmin, params.ymin, params.xmax, params.ymax,
map.spatialReference);
alert('new extent: ' + newExtent.xmin + ', ' + newExtent.xmax + ', ' + newExtent.ymin + ', ' + newExtent.ymax);
map.setExtent(newExtent);
var pe = map.extent;
alert('post extent: ' + pe.xmin + ', ' + pe.xmax + ', ' + pe.ymin + ', ' + pe.ymax);


The alerts show clearly that the "post extent" (the map extent after I call setExtent()) is not the same as the "new extent" (the extent passed to setExtent()). In fact the map extent seems to be totally unaffected by my call to setExtent().
There are no errors thrown either, that I can tell. I'm running in Firefox with Firebug, so I should be notified if there are errors.

The same thing also occurs with IE 8.

Anyone have ideas?

ArcGIS Server 9.3.1, JS API 1.5.

Outcomes