CJuiDialog load too slowly

Hi ,i m using CJUimodal for Ajax crud. i have some widjet in my form (Datepicker) . i have no problem when running in the local machine,but in the remote server the modal load too slowly,Help please

Hello. Can you check with Firebug the reason? It maybe that the modal loads jQuery and/or Jui upon modal opening. That would obviously take noticeable time.

thanks for bennouna. yes the probleme is that jquery load each time i call the modal. how can i cache jquery? to avoid downloading jquery every time


Use this:

Yii::app()->clientscript->scriptMap['jQuery-file-that-is-loading-that-you-dont-need.js'] = false;

As compact_corpse points out, you can set

scriptMap['jquery.js'] = false


scriptMap['jquery.min.js'] = false

in your controller (in the action method that renders the modal) or even in your config file (different syntax).

To handle both debug and non-debug modes:

Yii::app()->clientScript->scriptMap = array(

                    (YII_DEBUG ? 'jquery.js' : 'jquery.min.js') => false,

                    // You may need as well to set that for other scripts

                    // If you're not sure, check in Firebug what's going on

                    //'jquery-ui.min.js' => false,


But in any case, you may notice that the CJuiDatePicker is not working correctly. If jQuery has not been automatically loaded by the view calling the modal dialog, you can at least register jquery in that view.

Also check http://www.yiiframework.com/doc/guide/1.1/en/topics.performance#minimizing-script-files

and see http://www.yiiframework.com/forum/index.php?/topic/19205-jquery-loaded-twice/

and scriptMap in the documentation

THanks guys

I solved the problem using

   Yii::app()->clientScript->scriptMap['*.js'] = false;