Strange refresh issue when clicking update button on gridview

I have a strange refresh issue.

This is the workflow:

I have a gridview showing a list of user privileges.

I click on the update button and I go to the update form.

I make changes to a bunch of checkboxes on the form, then click save.

I’m redirected to the originating page where the gridview is.

Gridview shows the changes I just made.

I click on the update button (same record) again and the checkboxes on the form haven’t updated, they don’t show my last lot of changes I made.

If I refresh the page, the checkboxes get loaded correctly.

Also, if I bypass the update button on the gridview and just type in the update url manually into the browser, it shows the correct data - however whenever I use the update button on the gridview, it fails to show the updated data. Seems to be some sort of refresh issue.

I have tried turning off cache on the browser, no effect.

This is what I have:

Controller:




	public function actionOperatorsPrivEdit($id)

	{

		$model=$this->loadOperatorsPrivilegesModel($id);


		if(isset($_POST['OperatorsPrivileges']))

		{

			$model->attributes=$_POST['OperatorsPrivileges'];

			if($model->save())

				$this->redirect(array('prefs/operators'));

		}


		$this->render('operators/privilegesEdit',array('model'=>$model));

	}

	

	

	public function loadOperatorsPrivilegesModel($id)

	{

		$model=OperatorsPrivileges::model()->findByPk($id);

		if($model===null)

			throw new CHttpException(404,'The requested page does not exist.');

		return $model;

	}



The Form:





$form=$this->beginWidget('CActiveForm');


echo $form->labelEx($model,'Privilege');

echo $form->textField($model,'Privilege', array('size'=>30,'maxlength'=>25));

echo $form->error($model,'Privilege');


echo '<label>';

echo $form->checkbox($model, 'View');

echo 'View';

echo '</label>';

		

echo '<br/><label>';

echo $form->checkbox($model, 'Edit');

echo 'Edit';

echo '</label>';

	

echo '<br/><label>';

echo $form->checkbox($model, 'Delete');

echo 'Delete';

echo '</label>';


echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); 

$this->endWidget();




The GridView




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

	'id'=>'privileges-grid',

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

	'columns'=>array(

 		........

		........

	

		array(

			'class'=>'CButtonColumn',

			'template'=>'{update}{delete}',

			'buttons'=>array(

				'update' => array(

					'label'=>'Edit',

					'url'=>'Yii::app()->urlManager->createUrl("prefs/operatorsPrivEdit", array("id"=>$data->PrivilegeID))',

				),

	    	),

		),

	),	

)); 




Never mind, problem solved.

The controller was missing following code:




public function filters()

	{

		return array(

			'accessControl', // perform access control for CRUD operations

		);

	}