Add a javascript prompt before record delete in grid view

How would one specify a prompt before deleting a record in a grid view such as
alert(‘Are you sure you want to delete this record?’)
before executing the delete action?

isn’t it built already with Gii generated code?

Can you post example code where you get hard time understanding?

I searched the forum and did not find any answer related to my questions. Here is the code:

      <?= GridView::widget([
          'dataProvider' => $dataProvider,
          'filterModel' => $searchModel,
          'tableOptions' => ['class' => 'table'],
          'summary'=>'',
          'showFooter'=>false,
          'showHeader' => false,        
          'columns' => [
              ['class' => 'yii\grid\SerialColumn'],
                'vendor_name',
                'vendor_contact',
                [
                  'label' => 'Areas',
                  'value' => function ($model) {
                      return VendorsEntry::getVendorAreas($model->id);
                  }
                ],
              ['class' => 'yii\grid\ActionColumn',
                          'template'=>'{update} {delete}',
              ],
          ],
      ]); ?>

what is not working? Clicking delete will prompt confirmation. It is built in Gridview.
I do not understand your problem at all!

Unfortunately, I’m not getting a prompt on delete. Is there a parameter to tell the widget to display the prompt?

I’ve reviewed the gridview documentation, GridView, yii\grid\GridView | API Documentation for Yii 2.0 | Yii PHP Framework. There are no properties related to displaying a prompt before delete.

What method are you using to eliminate? json

'delete' => function($url, $model) {
        return Html::a('<span class="btn btn-sm btn-danger"><b class="fa fa-trash"></b></span>', ['delete', 'id' => $model['idasigticketsmaestro']], ['title' => 'Delete', 'class' => '', 'data' => ['confirm' => 'Desea Borrar el registro ? Esta seguro de esta acción', 'method' => 'post', 'data-pjax' => false],]);
}

Thank you. That works.

You should get it without any effort.
Without saying what you changed on the view it is difficult to say.
Example I provided should just work!

This is only necessary when you add custom action buttons, but for delete, it should just work!