更改 kartik dynagrid 操作列

Changing kartik dynagrid action column

我正在使用 kartik yii2 dynagrid.Am 试图更改操作 delete actioncolumn 但我收到一个错误

Method Not Allowed. This url can only handle the following request methods: POST.

我的代码:

['class' => 'kartik\grid\ActionColumn','dropdown'=>false,
    'order'=>DynaGrid::ORDER_FIX_RIGHT,
                      'template'=>'{delete}',
                        'buttons'=>[
                          'delete' => function ($url, $model) {     
           return Html::a('<span class="glyphicon glyphicon-plus"></span>', $url, [
                                    'title' => Yii::t('yii', 'delete'),
                            ]);                                

                          }
                      ]                            
]

其他操作运行良好,但更改 'template'=>'delete' 但仅删除操作失败。

data-method= "post" 属性包含到您的锚标记中

        'delete' => function ($url, $model) {
                  return Html::a('<span class="glyphicon glyphicon-plus"></span>', $url,

                      [  
                         'title' => Yii::t('yii', 'delete'),
                         'data-confirm' => "Are you sure you want to delete this item?",
                         'data-method' => 'post',
                         'data-pjax' => 0
                      ]);
             }