How to implement Multiple delete feature in CGridView


I have been trying and searching around for a way to implement a multiple delete feature in a grid view in my app, but to no avail.

How do I go about it? I couldn’t find anything relevant on the forums, but I am so sure that there must be something for such a simple thing. Please point me in the right direction. Any help would be highly appreciated.

Thanks in advance.

i think it can help you









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










I don’t see how that would help, presuming that Sid wants to delete multiple rows.

I think you will want to look at the jquery.yiigridview.js file to hook into the features there.

There is a selectRows capability in CGridView, so that if you set that to the number of rows per page, will allow you to select up to all the rows. You can then add your own link somewhere that calls the $.fn.yiiGridView.getSelection(containerID) to get the keys of all selected rows, and either loop through these, calling the delete action for each one, or create a custom multiple delete action that will accept an array of keys to be deleted.