我想問你一件事。 我想彈出一個模式,當我點擊網格視圖內的按鈕。這個代碼可以用yii2 Grid View嗎?顯示在Yii2彈出GridView
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'ID',
'DATASEQ',
'TIME',
'QTYOK',
'QTYDEFECT',
$actionCol=['class' => 'yii\grid\ActionColumn',
'template' => '{view}{info}',
'buttons' => [
'info' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-info-sign"></span>', $url, [
'id' => 'modalButton' ,
'title' => Yii::t('app', 'Info'),
]);
}
],
'urlCreator' => function ($action, $model, $key, $index) {
if ($action === 'info') {
$url = Url::to(['../web/plan-detail-tiga/create','id'=>$model->DATASEQ]);
return $url;
}
}
],
],
]); ?>
您是否嘗試過這些解決方案? –