I’m trying to set up CGridView, in order to select multiple rows using CCheckBoxColumn.
By default, when a checkbox is checked, it adds a "selected" html class to the row <tr class="selected">…</tr>
and you can only select 1 row
I added ‘selectableRows’=>5, so I can select 5 rows max…
I’ve got 2 problems :
the max value (5) doesn’t work, I can select 10 items… how to correct that ?
the “.selected” class in the <tr> doesn’t work anymore since I addded the “selectableRows” …
Thank you in advance if you got the answer !
In documentation we can read :
"Checking a checkbox has nothing to do with selecting the row", so you have to ensure that when you check a box, you select the line aswell, but you have to do it yourself. Thus, you could reach the limit of checked box and line selected.
then we can also read :
"null - CGridView::selectableRows is used to control how many checkboxes can be checked. Checking a checkbox will also select the row."
Thus, I understand that what you’re looking for needs to be tricked a bit =)
For example, you can use HtmlOption to add class="selected" to your row when you check the box.
check this stack overflow