john.c.cartwright

different Map behavior in 3.4 between "require" and AMD style loading

Discussion created by john.c.cartwright on Apr 2, 2013
Latest reply on Apr 25, 2013 by DSwingley-esristaff
Hello All,

I'm using v3.4 and finding some differences in the Map behavior when using the older "require" style module loading and the newer AMD style.  I'm using a BorderContainer with the map in the center panel and finding that w/ AMD, I have to explicitly call map.resize() to get it to fill the panel.  Also, w/ AMD the "center" property of a Map doesn't seem to have any effect. Listed below are two examples that I'd expected to provide identical results, but don't.  I assume it has something to do w/ the timing of the module load, but I'm not clear on what to do differently.

Thanks for any help!

--john

//works OK
function initMap() {
    map = new esri.Map("map", {
       basemap: "oceans",
       center: [-102, 40],
       zoom: 5
 }); 


require(["esri/map"],
   function(Map) {
      var map = new Map("map", {
         basemap: "oceans",
         center: [-102, 40],  //does not seem to be respected
         zoom: 5});

   //not sure why this seems to be required w/ AMD loaded module
   map.resize();
});

Outcomes