Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to stop yii cgridview getting it's jquery files in each ajax update call

Tags:

jquery

php

yii

I'm working on a Yii application in which in some part of it I need to use a CGridView to show some database records.My aim is to update it's result by an ajax call(based on some filters on table columns) but the problem is in each call CGridView establishes a new get request for getting it's related jquery files and this causes increasing my website loading time.
Is there any way to tell CgridView to get these files only one time in the first ajax request? how can I stop it from getting these files several times?

like image 662
Ehsanjs Avatar asked Oct 08 '12 08:10

Ehsanjs


1 Answers

Use scriptMap to prevent loading of jquery files in your ajax call.

Yii::app()->clientScript->scriptMap=array(
                    'jquery.js'=>false,
                    'jquery.ba-bbq.js'=>false,
                    'jquery.yiigridview.js'=>false
                ); 

You can get or load js file externally, you can found your answer here.

like image 66
Onkar Janwa Avatar answered Oct 23 '22 02:10

Onkar Janwa