Search code examples
jqueryjqwidget

use multiple version of JQWidget


is there any way to use multiple (at least 2 for now) version of JQWidget in one document?

i'm using 3.0.x vertion of JQWidget for jqxGrid (which i can not upgrade for some reason)

but i want to use 3.6.x JQWidget for jqxChart (it's bug-fixed and has candlestick chart)

thanks in advance


Solution

  • jqwidget 3.6.0 gets jquery object from window.jQuery. so if you changed window.jQuery before loading jqwidget script, you could get jqx-functions into a different version of jquery object. (which is obtained via noColflict)

    <script type="text/javascript" src="/scripts/jquery/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="/scripts/jqwidget/jqx-all-3.0.4.js"/>"></script>
    <script type="text/javascript" src="/scripts/jquery/jquery-1.10.2.min.js"></script>
    <script>
    window.jQuery_jQWidget_3_6_0 = $.noConflict(true);
    window.jQuery_jQWidget_3_0_4 = window.jQuery;
    window.jQuery = window.jQuery_jQWidget_3_6_0;
    </script>
    <script type="text/javascript" src="/scripts/jqwidget/jqx-all-3.6.0.js"/>"></script>
    <script>
    window.jQuery = window.jQuery_jQWidget_3_0_4;
    var $jqx = window.jQuery_jQWidget_3_6_0;
    </script>