Apply selected class on checkbox checked

How it is possible to apply selected class on rows when GridView checkbox checked?

Again :)

You may use this :$checkboxOptions-detail

For example :

‘checkboxOptions’ => function($model, $key, $index, $column) {

// whether checked is boolean

if ($model->checked) {

return [‘class’ => ‘myClass’];

} else {

return [‘class’ => ‘otherClass’];



Do you use it?

No it is not answer of my question,I want to apply a css background class on the row when I select a checkbox.

You may use jquery for it.

For example :

$('.checkbox').click (function(){

  var thisCheck = $(this);

  if (':checked') ) {


  } else {




Bind an onClick event to the checkbox something like:


if ($(this).is(':checked')){


} else {




Obviously the exact code around (.parent()) will depend on your DOM structure.

Thank you so much.