multi CViewList, how to disable js ?

Hello.

I have on page some CListView widgets, some of them is loaded by ajax with forms(jquery.form.js) like tabs.

i need to add yiilistview.js in ajax response, when CListView is not needed get.

fix this problem by add this code on startup application




if(Yii::app()->getRequest()->getIsAjaxRequest())

		{

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

		}

I am not sure if I understand your question, but I guess you have a problem with javascripts loaded more than once or processing javascript on AJAX requests. That’s a frequent problem. First, if a AJAX request renders another widget than you may need to run processOutput() by setting the fourth parameter of renderPartial to true:


$this-renderPartial('_partialView',array('data'=>$data),false,true);

If subsequent requests reload javascripts again and again although they are already loaded you may use clientScripts scriptMap property to prevent reloads:


if(Yii::app()->request->isAjaxRequest)

    Yii::app()->clientScript->scriptMap=array('yiiListView.js'=>false);

Third hint: Always assign your own ids to your widgets as Yiis auto id generator won’t take partially rendered widgets into account leading to weird results that are hard to debug.

Greetings,

Hannes

thanks, good remarks.

my widgets depend by various jquery.plugins so it’s not posible manualy prevent his load.

I need more control around js generated by CAssetManager.

now i try doing by using packages and registryCoreScripts, but system widgets is using AssetManager.

union functionality packages and AssetManager is best for me