Confirmation box for Kartik grid delete

Hi everybody, I would like to understand what I am doing wrong.
I have a kartikgrid that registers entries and a grid and a column action with few buttons to operate on them and one them is the delete action.
Delete action is only allowed with post and not get.

The layout is the following:

I would like to get confirmation upon deletion.
I have used the following options to configure for the post:

'deleteOptions' =>
                   ['class' => 'glyphicon glyphicon-trash', 'data-modal-type' => 'confirm',
                           'label' => '<i class="fas fa-remove"></i>', 'data-type' => 'danger', 'data-method' =>'post', 'data-confirm' => false],

The element from the grid are removed without asking as expected,

By changing the configuration to:

'deleteOptions' =>
                   ['class' => 'glyphicon glyphicon-trash', 'data-modal-type' => 'confirm',
                           'label' => '<i class="fas fa-remove"></i>', 'data-type' => 'danger', 'data-method' =>'post',
                       'data-confirm' => Yii::t('app', 'Sicuro di voler rimuovere la presenza?'),],

I get the following error from the server:

Any suggestions on hoe to fix?
many thanks
Andrea

Podrías utilizar Ajax, al momento de dar click al botón de eliminar, que se ejecute una función la cual puedes hacer uso de alguna libreria como SweetAlert para preguntar si desea eliminar antes de ejecutar el Ajax

Despite I am not experienced with Ajax I tried this approach see code,
but the result was that the item was deleted either when select confirm or cancel.

     'buttons' => [

                    'delete' => function ($url, $model) {
                        return Html::a('<span class="glyphicon glyphicon-ban-circle"></span>', $url, [
                                    'title' => Yii::t('app', 'NDel'),
                                    'data' => 'post', 
                                    'data-pjax' => '1',
                                    'data-confirm' => Yii::t('yii', 'Are you sure you want to delete?'),
                        ]);
                    },

and I do not understand why.