Multiple selection of rows in CGridView

Multiple selection of rows in CGridView

I use CGridView for displaing my data models. I need to have checkboxes on each row and to be able to select some rows, and do some action with the selected rows. For example, to do multi-delete. How could I do that?

p.s. I know that there are CCheckBoxColumn, but it just places checkboxes which is "attached" to some attribute name of model.

anybody? :rolleyes:

It’s probably best to use some custom javascript. Like:

  • Add a button e.g. "Delete all selected"

  • Attach a click handler to that button that collects the current selected rows with $.fn.yiiGridView.getSelection(id)

  • Do whatever you want with that information (e.g. send a AJAX request with jquery.post())