Select to view content in your preferred language

converting 2.8 to 3.7

572
1
09-27-2013 09:58 AM
JohnCartwright
Deactivated User
Hello All,

I'm trying to convert an application w/ custom modules from 2.8 to 3.7.  I'd hoped to phase in this transition to AMD and tried initially simply replacing the references to 2.8 to those using 3.7. Unfortunately, this doesn't seem to work w/ complaints about missing jsapi_en-us.js, "define is not defined", etc.

I'd understood that the the 3.7 was backward compatible w/ non-AMD code - can someone please help me?

Thanks!

--john
0 Kudos
1 Reply
SteveCole
Honored Contributor
I'm still trying to avoid the migration to AMD myself but I think you might need to focus on the API versions 3.4, 3.5, or 3.6. A good place to start is the "What's New" section of the Concepts site (link for the What's New for v3.4).

I don't know about the custom module side of things but a few gotchas to pay attention to when moving from 2.8 to the 3.x series of APIs:

1. djConfig in your HTML header changes to dojoConfig
2. Remove any "lang=EN" from your <HTML> tag! For some darn reason, this breaks your app so, if you have it, remove it.
3. Any code that references the esri namespace can't run until after all the modules have loaded. In the 2.8 days, I might have a global variable for the initial extent declared outside of my initMap function like this:
var initExtent = new esri.geometry.Extent({
   "xmin": -13592500,
   "ymin": 6060280,
   "xmax": -13506825,
   "ymax": 6166129,
   "spatialReference": {"wkid": 3857}
 });

This chokes in the 3.x APIs because of the esri.* reference. The solution is like this:
var initExtent;

function initMap() {
 initExtent = new esri.geometry.Extent({
   "xmin": -13592500,
   "ymin": 6060280,
   "xmax": -13506825,
   "ymax": 6166129,
   "spatialReference": {"wkid": 3857}
 });
}

dojo.Ready(initMap);


I now also use dojo.Ready() instead of dojo.OnLoad() to call the map setup function at page load. I think these are the biggest issues in general when updating from v2.8. Hopefully someone else can provide some wisdom about your situation with the custom modules.

Good luck!
Steve
0 Kudos