Wednesday 29 February 2012

jQuery vs ApexLib... FIGHT!

Recently I was working in an environment where they were running Apex 3.2. While I didn't hold that against them, I wanted to use some jQuery functionality. There was a problem with that because they had also configured ApexLib within their Apex instance.

For those unfamiliar with ApexLib, it's a development framework that improved the out-of-the-box features of Apex. In part thanks for Patrick Wolf moving to Oracle, we now find a lot of these features incorporated into the Apex 4.x product, such as the Apex Advisor.

Back to the business at hand, I must first state I'm no JQuery expert. I know how to copy & adapt, the rest I'm working on. What I do know is that having two JavaScript frameworks on the same website may cause the universe your website to explode with obscenely generic errors such as:

Message: Object doesn't support this property or method

The long and short of it is we need to use jQuery.noConflict()

This is documented specifically at the JQuery website, with further documentation about using jQuery with other libraries.

Here is all I needed to do - add the jQuery.noConflict line and modify the prefixes to use $j.

If you are currently running Apex 3.2 and plan to upgrade to Apex 4.x, this OTN forum entry may also be of interest.

As for the post title, it's funny the random things that make you think of something from a long time ago... I digress.



  1. Hi Scott,

    when i saw your blog-post-title i was worried something in ApexLib broke your App, but in fact this isn't about ApexLib at all, is it?

    What kind of problems did you experience when using ApexLib and some other Framework?

    Since Version 2 ApexLib also namespaces jQuery, from there you shouldn't have any side-effects.


  2. Hi Peter,

    I'm not at that site at the moment, but I believe they were at Apexlib 1.7, with Apex 3.2

    They were holding up upgrading to 4.x, but I've informed them about your 2.2 updates.

    The cogs of progress turn slowly...