GSTAR
(Omzy83)
October 26, 2010, 11:40am
1
Basically I manually include jQuery and jQuery UI scripts in my layout file and I prevent Yii from publishing it’s own jQuery library. As follows:
<?php echo CHtml::scriptFile(bu('js/jquery-1.4.2.min.js')); ?>
<?php echo CHtml::scriptFile(bu('js/jquery-ui-1.7.2.custom.min.js')); ?>
<?php
Yii::app()->clientScript->scriptMap=array(
'jquery.js'=>false,
);
?>
The problem I’m experiencing now is that if I use any of the CJui Widgets they will also publish their own version of jQuery UI. I tried doing ‘jquery-ui.js’=>false, in my scriptMap but that does not have any effect.
I’m using v1.1.3
zaccaria
(Matteo Falsitta)
October 26, 2010, 12:04pm
2
You should set scriptFile and cssFile to false.
You can achive this in config/main using widgetFactory.
something like that:
'widgetFactory'=>array(
'class'=>'CWidgetFactory',
'widgets'=>array(
'CJuiDatePicker'=>array('cssFile'=>false, 'scriptFile'=>false)
)
),
GSTAR
(Omzy83)
October 26, 2010, 12:13pm
3
zaccaria:
You should set scriptFile and cssFile to false.
You can achive this in config/main using widgetFactory.
something like that:
'widgetFactory'=>array(
'class'=>'CWidgetFactory',
'widgets'=>array(
'CJuiDatePicker'=>array('cssFile'=>false, 'scriptFile'=>false)
)
),
Now I am getting an error message:
jQuery("#mydialog ").dialog is not a function
zaccaria
(Matteo Falsitta)
October 26, 2010, 12:40pm
4
That’s good, it proves that CWidgetFactory did his job, by preventing to include the Yii version of jquerui.
Now you have to include your own version.
GSTAR
(Omzy83)
October 26, 2010, 12:45pm
5
Yes it’s already included at the top!
zaccaria
(Matteo Falsitta)
October 26, 2010, 12:48pm
6
That is strange, maybe your version does not include dialog.
This error simply states that you miss the code of dialog, that is defined by js/jquery-ui-1.7.2.custom.min.js.
This is not a problem with framework, just check if the files really exist in your page and if they are corrected.
GSTAR
(Omzy83)
October 26, 2010, 1:02pm
7
Yes boss, you were right. I had a very minimal version of jQuery UI that did not include dialog or tabs and many of the other widgets! I have now downloaded and included the latest version (1.8.5) and all works well now! Only slight drawback is the size of the new script - 199KB! Ouch!