我有一个gridview,只在ActionColumn中启用了Delete按钮。当我按下删除按钮时尝试从确认框中单击ok
时没有问题。问题是在确认时按下cancel
按钮。会发生什么,它会根据rowOptions返回的url重定向页面。
[
'class' => 'yii\grid\ActionColumn',
'template' => '{delete}',
],
],
'rowOptions' => function($model, $index, $attribute) {
$url = "whatever url"
if ($index > 0) {
return [
'onclick' => "window.location.href='{$url}'",
'style' => 'cursor:pointer'
];
}
}