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.

Scott
Post a Comment