Add a checkbox in the datagrid columns to be able to delete several records together, everything works fine. What I am looking for is that when selecting the rows to be deleted, they are painted in one color. Is there any way to do it?. I'm working with Yii2. Thanks.
<?= GridView::widget([
'id' => 'grid',
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'layout' => '{items}{pager}{summary}',
'pager' => [
'options' => ['class' => 'pagination float-right'], // clase para el elemento <ul> de la paginacion
'linkOptions' => ['class' => 'page-link'], // clase para los links <a href> de la paginacion
'linkContainerOptions' => ['class' => 'page-item'], //clase para los elementos <li> de la paginacion
'disabledListItemSubTagOptions' => ['class' => 'page-link'], // clase para los span que tienen flechas
],
'columns' => [
[
'class' => \common\components\CheckboxColumnCustom::className () ,
'content' => function($model) {
return Html::checkBox ( 'selection[]' , false , [ 'id' => "customCheck" . $model->id, 'value' => $model->id] ) . '<label for="customCheck' . $model->id . '"></label>';
} ,
'contentOptions' => function($model, $key, $index, $column) {
return [
'class' => 'md-checkbox' ,
];
} ,
'headerOptions' => ['class'=>'md-checkbox'],
'header' => Html::checkBox ( 'selection_all' , false , [ 'id' => 'customCheck', 'class' => 'select-on-check-all' ] ) . '<label for="customCheck" class="header"></label>'
] ,
'tela',
'descripcion',
'nom_proveedor',
'composicion',
[
'class' => 'yii\grid\ActionColumn',
'template' => Helper::filterActionColumn('{view} {delete}'),
'buttons' => [
'delete' => function ($url) {
return Html::a("<button class='btn btn-danger p-2'><i class='fa fa-trash text-center'></i></button>", $url, [
'title' => 'Eliminar',
'class' => 'delete',
]);
}, //fin delete
'view' => function ($url) {
return Html::a(Yii::t('yii', "<button class='btn btn-warning p-2'><i class='fas fa-palette text-center'></i></button>"), $url, [
'title' => Yii::t('yii', 'Colores'),
'class' => 'view',
]);
}, //fin view
] // fin buttons
],
],
]);
?>