Today jQuery is widely used for the development of GeneXus User Controls. Many of the controls in GeneXus marketplace use it (eg: Uploadify, Smooth Navigational Menu, scaMessage, etc)
For therese controls to work properly while more than one is present on a web panel (including the master page and web components) we must take certain considerations.
In order to avoid some problems we created an standard to import the relevant dependencias of the user control so can minimize the risks. It follows the same idea as gxui Library by using a Shared folder in order to share files of ExtJS. The same folder should be used for jQuery as well.
The following common detected files will be placed under your %GX PROGRAM DIR%\User Controls\Shared:
- jquery
- jquery-1.4.2.min.js
- jqueryui
- jquery-ui.min-1.8.js
- i18n
- jquery-ui-i18n.js
jQuery version 1.4.2 is being used at the moment because it is compatible with all the user controls that are based on jQuery. If you need to use a newer version you must not overwrite the existing one but add your new version including the version number to the Shared folder and reference it as usual in your user control. Please contact marketplace@genexus.com if you are in this situation in order to evaluate the compatibility with the rest of the user controls.
1) In .control file, instead of importing the references using the <File> tag, you need to use <SharedFile> tag.
For instance, taking Uploadify as an example
<ReferencedFiles>
<File>uploadify.css</File>
<File>swfobject.js</File>
<SharedFile>jquery/jquery-1.4.2.min.js</SharedFile> <-- This reference goes to the Shared folder
<File>jquery.uploadify.v2.1.0.min.js</File>
</ReferencedFiles>
2) In the zip of your user control, please include the Shared folder and additional required files. That helps the user to start using your user control without any additional step.
See HowTo:Using more than one jquery version