CgridView Delete Button Problem

Hi All,

I am working on CgridView. I want to display a message whenever an entry is deleted from the Grid.

Right now it is deleting the entry but not showing any confirmation message that the message is deleted. Yes, it asks before deleting but I want to confirm it by showing the display message that the message is deleted.

The code that I am using is:


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




















Any help will be appreciated


If i’m not mistaken, flash messages would be your sollution, try setFlash() method

Just recently CButtonColumn::afterDelete was added for this purpose -…e/detail?r=2965

To get this you need to get the SVN version or wait for version 1.1.7

But note that even if you get a successful ajax call it does not mean that the delete was successful.

Thanks a lot…

So is it any way to do that till 1.17 is released???

And can u give me an example how to use this property

You can download the "Nightly Snapshot" on the Yii download page





   'afterDelete'=>'function(link,success){ if(success) alert("Delete completed successfuly"); }',



Thanks for the reply

But the nightly snapshot is not yet stable

Can i still use it??

and sorry to sound stupid but how to upgrade my already existing code to this release…

Can it break my functionality by any means??


Of course it might break functionality if you are unlucky. Examine the change log for changes that may constitute a risk.


You have not specified what version you are using currently… if you are using Yii 1.1.6 than most probably you will not have any problem…

But …

the nightly snapshot is made every night… so if you decide to use it… you need to track the changes made that day as almost every day there is a new commit…

you can see the changes here -

In any case first thing to do is a backup of your complete project with the current Yii version…

On the other side… for this case… if you need just the afterDelete option you can download only the CButtonColumn.php file on link I wrote you in comment #3

Thanks a lot.

I have upgraded to the nighty sample and till now everything is working fine.

I hope to same to remain


I am using Yii Versionn 1.1.4

Downloading only CbuttonColumn didn’t help

I am getting an error

Property CButtonColumn.afterDelete is not defined

Strange because the afterDelete is declared there… if you want to use only the new CButtonColumn, then you need to put it in the framework folder (replace the old one)… and it should work…


It worked…

I might have done something wrong earlier…

I have tried that again and replacing only CButtonColumn had solved the problem…

Thnx for helping me out


Just today I changed a bit the afterDelete… added 3rd parameter (data) so that you can get the result of the server call in afterDelete…


Thnx for the info…

so should I get the latest nightly build for this file???


Is either that or customize your CButtonColumn