CGridView ajaxUpdate

When table updates by ajax, in firebug i see two equal requests(picture in atachments).

Controller:


 public function actionUsers()

     {

        $model =new Users('search');

       if(isset($_GET['Users']))

         $model->attributes =$_GET['Users'];

       

       if(!isset($_GET['ajax'])) $this->render('users', array('model'=>$model));

	    else  $this->renderPartial('usersList', array('model'=>$model),false,true);

     }

view users:


<? $this->renderPartial('usersList',array('model'=>$model),false,true);?>

view usersList:


<? $this->widget('zii.widgets.grid.CGridView', array(

						'id'=>'usersGrid',

						'dataProvider'=>$model->search(),

						'filter'=>$model,

						'ajaxUpdate'=>true,

						'template'=>'{pager}{items}',

						'enableSorting'=>true,

						'columns'=>array(

								array('name'=>'user_ID','header'=>'ID'),

								array('name'=>'login'),

								array('name'=>'email'),

								array('name'=>'reg_date','header'=>'Registration Date'),

								array('name'=>'icq','header'=>'ICQ'),

								array(

									'class'=>'CButtonColumn',

								),

						),

					));?>

up

need help.

Tell us more or check these two possible causes

  1. ajaxValidation=true in the form will generate two calls when submitting the form

  2. side effect of the fourth parameter to renderPartial (processOutput=true) loading scripts more than once

/Tommy

When I change page or apply filter, there are two equal requests, they return right data, but why they duplicate?

If I remove fourth parameter, ajax will not work at all, I get an error:

$.param.querystring is not a function.

There’s already tons of threads about this or similar problems. Since you didn’t post the whole view, all I can say is that you probably don’t have required scripts available on initial page load. I guess somebody with recent experience from this situation will soon post a better explanation.

/Tommy