Multiple jquery-ui script import

Hi all,

I have a form which contains a couple of "CJuiDatePicker" widgets. When these are loaded a copy of "jquery-ui" version 1.9.2 is loaded from the Jui scripts in my Yii framework folder. My problem is that I have another component on this page which also requires "jquery-ui", however it needs version 1.11.2 to function correctly. Currently the page loads the 2 versions, and there is a conflict which breaks one of the components. I am able to fix this by manually replacing the jquery-ui script in my Yii framework source with version 1.11.2, however I am not sure if this is a safe thing to do. Has anyone else experienced anything like this, and is my workaround acceptable?

I would like to assume that jquery-ui is backwards compatible but am not sure…

Any help would be greatly appreciated.

Thanks!

You can use script map to globally specify where jquery, jqueryui, and your theme files should be coming from.

Here’s an example, goes inside your config file, under clientScript




'scriptMap' => array(

	'jquery.js' => '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js',

	'jquery.min.js' => '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js',

	'jquery-ui.min.js' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js',

	'jquery-ui.css' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/black-tie/jquery-ui.css',

),

Perfect, thanks very much for that!