0

I have a listing page where I display email lists and if I want to delete any list I do not actually delete it but it is marked as deleted in the table column.
For the email_lists I am using the GridView widget for displaying the lists and I want to highlight a row if it is marked as deleted in the table email_lists.

Any idea how can I highlight the whole row instead of column?

<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'columns' => [
        ['class' => 'yii\grid\SerialColumn'],
        'name',
        'total_recipients',
        'list_type',
        // 'is_deleted',
        [
            'class' => 'yii\grid\ActionColumn',
            'header' => 'Actions',
            'template' => '{update}{view_list}{delete}',
            'buttons' => [
                'view_list' => function($url, $data, $key) {
                    return Html::a('<i class="glyphicon glyphicon-eye-open"></i>', ['/promos/promolistemails/index', 'id' => $data->id], ['title' => 'View List Emails']);
                },
                'update' => function($url, $data, $key) {
                    if ($data->list_type == 'custom') {
                        return Html::a('<i class="fa fa-pencil"></i>', '#.', ['title' => 'Edit List Emails', 'data-url' => yii\helpers\Url::to(['/promos/promolists/update', 'id' => $data->id]), 'class' => 'edit-list']);
                    } 
                },
                'delete' => function($url, $data, $key) {
                    if ($data->list_type == 'custom') {
                        return Html::a('<i class="fa fa-trash"></i>', $url, ['title' => 'Delete List', 'data-method' => 'post', 'id' => 'delete-list']);
                    }
                },
            ]
        ],
    ],
]); ?>

2 Answers 2

1

i need to use the rowOptions for the GridView

'rowOptions'=>function ($model, $key, $index, $grid){if($model->is_deleted){return ['class'=>'red'];}},
Sign up to request clarification or add additional context in comments.

Comments

1

Try This one

'rowOptions' => function($model, $key, $index, $grid){
    if($model->is_deleted){
        return ['class' => 'danger'];
    }
},

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.