Last week I blogged about the fact that select2 v4 used define.amd and because of that dojo screws up the jQuery plugin.
This has been a significant issue – not hard to deal with but comes up all the time for XPages eedevelopers.
In the blog post comments Ferry Kranenburg posted a link to a solution he uses which is also an XSnippet. It is brilliant.
What he does in the XSnippet is:
- duplicates define.amd to define._amd
- deletes define.amd
- loads the AMD enabled jquery plugin (successfully)
- duplicates define._amd back to define.amd
- deletes define._amd
Rather than post the code here I want you all to go to the XSnippet and get it from there – and vote it up while you are there.
Personally I would prefer not to use <xp:this.resources> or at best use them wisely and you could easily write this without using resources should you so chose.
Big Problem – simple and elegant solution – well done Ferry and thanks for Sharing
Now go vote up his XSnippet !!!