Select to view content in your preferred language

jQuery lib update breaks map

983
6
06-23-2010 01:01 PM
KevinGooss
Regular Contributor
I use jQuery for quite a bit of stuff to go with the dojo that esri needs for the map.
I was using 1.3.2 for jQuery and things were going fine.
When i upgrade to 1.4.2 I get no events firing on the map. I can't trap onLoad or onLayerAdd.
I can get a map with dynamic layers (like esri street map) but i can't get any of my server layers. The street map layer actually loads but doesn't throw the onLayerAdd event.
Has anyone else experienced this?
Is there some conflict?
0 Kudos
6 Replies
AlessioDi_Lorenzo
Emerging Contributor
I'm using jQuery 1.4.2 with the arcgis apis for google maps and it works fine.
If you are using Dojo... use Dojo. In general it is not good to mix libraries that have the same goal.
Anyway, you can try to use jQuery in compatibility mode.
0 Kudos
KevinGooss
Regular Contributor
no luck using the noConflict call.
I didn't think dojo used the $ syntax so I would not expect a conflict there.
I am successfully using esri's js api and jquery 1.3.2 right now with no issues so I'm not sure what the difference could be with upgrading to 1.4.2 but it appears that all map events are not reacting now.
0 Kudos
BrettLord-Castillo
Deactivated User
is $() still bound to jQuery() after the page loads?
If not, you need to find when it is coming unbound and rebind it, or change your $() calls to jQuery() calls.
0 Kudos
KevinGooss
Regular Contributor
I have over a hundred $'s in my entire codebase. I could change them all to see if that is truly the issue but it sounds like a lot of work and i was under the impression that dojo and jQuery would not fight club one another.
0 Kudos
BrettLord-Castillo
Deactivated User
You don't have to change your code to test. Just open your application in firebug and wait for everything to load. When you are done, try calling $() from the command line and see if it returns Document. (or see if $ returns a function)
If you don't get the expected results, then $ was broken somehow. I had this happen before with dojo and jQuery, but I'm not sure how it happened.
0 Kudos
PraveenPonnusamy
Esri Contributor
It could be a timing issue. Try creating a reduced test case of the problem - start small so the problem can be isolated. I have attached a sample that makes use of jQuery and jQuery UI widgets around ArcGIS API map. Perhaps, you can compare and contrast this sample with your code.

-Praveen
0 Kudos