Php 如何在YII2中添加引导模式以更新操作
我知道下面的代码使用ADD按钮创建引导模式。我想让这个工作在更新按钮。下面是索引页的yii2 action列。 我需要在单击更新按钮时打开引导模式 模态码 索引页中的操作列Php 如何在YII2中添加引导模式以更新操作,php,twitter-bootstrap-3,yii2,bootstrap-modal,Php,Twitter Bootstrap 3,Yii2,Bootstrap Modal,我知道下面的代码使用ADD按钮创建引导模式。我想让这个工作在更新按钮。下面是索引页的yii2 action列。 我需要在单击更新按钮时打开引导模式 模态码 索引页中的操作列 那么,您是否进行了任何测试、尝试,或者您是否要求我们直接为您创建代码?我尝试了将代码相应地放在按钮部分。但是,它显示了许多错误。所以我要求任何简单的实现。我需要在单击更新按钮时呈现更新表单。请看 Modal::begin([ 'toggleButton' => [
那么,您是否进行了任何测试、尝试,或者您是否要求我们直接为您创建代码?我尝试了将代码相应地放在按钮部分。但是,它显示了许多错误。所以我要求任何简单的实现。我需要在单击更新按钮时呈现更新表单。请看
Modal::begin([
'toggleButton' => [
'label' => '<i class="glyphicon glyphicon-plus"></i> Add',
'class' => 'btn btn-success'
],
'closeButton' => [
'label' => 'Close',
'class' => 'btn btn-danger btn-sm pull-right',
],
'size' => 'modal-lg',
]);
$newmodel = new Comment();
echo $this->render('/comment/create', ['model' => $newmodel]);
Modal::end();
[
'class' => 'yii\grid\ActionColumn',
'template' => '{view} {update} {delete}',
/* 'buttons'=>[
'view' => function ($url, $comment) {
return Html::a('<span class="glyphicon glyphicon-plus">
</span>',$url,
[
'title' => Yii::t('yii', 'view'),
]);
}
], */
'urlCreator' => function ($action, $dataProvider, $key, $index) {
if ($action === 'view') {
$url = Yii::$app->urlManager->createUrl('option?id='.$key.'');
return $url;
}
if ($action === 'update') {
$url = Yii::$app->urlManager->createUrl('question/update?id='.$key.'');
return $url;
}
if ($action === 'delete') {
$url = Yii::$app->urlManager->createUrl('question/delete?id='.$key.'');
return $url;
}
}
],