0
votes

I am using Yii2 gridview with custom action button. On click custom button i want to update status of that record and hide that row from gridview. Also want to show success message.

[  
    'class' => 'yii\grid\ActionColumn',
    'header'=>'Actions',
    'template' => '{confirm}',
    'buttons' => [

        //view button
        'confirm' => function ($url, $model) {
            return Html::a('Confirm', $url, [
                'title' => Yii::t('app', 'Confirm Address'),
                'class'=>'btn btn-success',                                  
            ]);
        },
    ],

    'urlCreator' => function ($action, $model, $key, $index) {
        if ($action === 'confirm') {
            return Url::to(['customers/confirmaddress','id'=>$model->id]);

        }
    }
]
1

1 Answers

1
votes

You can Pjax at beginning of GridView and configure dateProvider to show those value having status other than update Status value on confirm prompt an alert box and make your confirm button to data-pjax => true so handle pjax request and update your Pjax -container after ajax request is successfull .. provide some more extra controller code