Delete action

Can any one help me.

In grid.CGridView delete action should change the status , ie status=0 to status=1 how it is possible.

What really is the ‘status’ ? if a variable/field in the model then you can try this inside the actionDelete:

$this->status = 1;

Again I’m totally unsure what you want to do and what is the context you are working in, I suggest paste your code.

You Code $this->status =1; is not working

In grid.CGridView we have delete icon to delete the record, In my case I dont need to delete the record , just I need is to change the status.




$models = Courses::model()->findAllByAttributes(array("id"=>1));

$models->status= 1;

$models->save();



this action to be performed

In that case try:

$id = Yii::app()->request->getQuery(‘id’);

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

$model->status = 1;

$model->save(false);

See if this works for you.

Thank you very much this is working fine…Thanks for your help.

You are welcome.