CGriView Row Selection


I need to highlight selected row manually.

Which mean not using ‘selectableRows’=>1 settings in CGridView.

How to apply style for selected CGridView <tr>?

Thank you

CGridView… .to show a row as selected adds/removes the class "selected" to a row…

How to access selected row?


or what?

Dear mdomba,

I found the way to highlight the row using below code snippet:


But how to remove the previously selected row highlighting (CSS class - selected)?

Thank you

Dear mdomba,

I have found the way to do this using jQuery:



Anyway thank you for your effort.


I also faced with need to select row via script.

I think it’s not enough to simply set class of selected row. CGridView also stores checked rows in array:


$checks.prop('checked', true);

$checksAll.prop('checked', true);

It would be good to add setSelection methos to YiiGridView.

Hi all

I’ve researched issue and created extension that allows to select rows by GET param

and remembers selected rows on sorting / paging

Link to extension: SelGridView

Feel free to comment.