yii弹出层插件怎么用 [ 2.0 版本 ]
index.php代码:
<?= app\widgets\GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\CheckboxColumn'],
'title',
[
'attribute' => 'cate',
'format' => 'raw',
'value' => function($model){
if($model->cate==0){
return Html::a(未设置, ['select', 'get' => 'cate' , 'id' => $model->id], ['class' => 'a-select','id'=>cat.$model->id]);
}
return Html::a(\common\models\Article::$cates[$model->cate], ['select', 'get' => 'cate' , 'id' => $model->id], ['class' => 'a-select','id'=>cat.$model->id]);
}
],
[
'class' => 'app\widgets\ActionColumn',
'buttons' => [
'updates' => function($url, $model){
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url);
},
],
'template' => '{updates} {view} {delete}',
],
]
])?>
我想在这里面把修改做成弹出层的,但不知道弹出层插件怎么用?请各位教我一下 在这里面该怎么加弹出层,谢谢各位了
共 1 个回答
-
给你个例子:
'class' => 'yii\grid\ActionColumn', 'header'=>'<a href="#">操作</a>', 'template' => '{updaterule}', 'buttons' => [ 'updaterule'=>function($url, $model){ return Html::tag('span',"", [ 'class'=>"fa fa-wrench", 'style'=>'cursor:pointer', 'title' => Yii::t('yii', 'Edit'), 'data-toggle'=>"modal", 'data-target'=>"#**mymodal**"//自己定义的弹出层 ]); },
弹出层
<div class="modal" id="**mymodal**" tabindex="-1" role="dialog" aria-labelledby="GuestModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header">
id名称相同,,bootstrap会自己调用
共 8 条回复[
'class' => 'app\widgets\ActionColumn', 'buttons' => [ 'updates' => function($url, $model){ return Html::a("<span title='修改' data-container='body' class='glyphicon glyphicon-pencil' data-toggle='modal' data-target='#myModal'></span>"); }, ], 'template' => '{updaterule} {updates} {view} {delete}', ],
弹出层代码:
<div class="modal-dialog"> <div class="modal-content"> <div class="modal-header">
辰枫夜雨
注册时间:2015-08-11
最后登录:2017-06-23
在线时长:18小时59分
最后登录:2017-06-23
在线时长:18小时59分
- 粉丝10
- 金钱0
- 威望0
- 积分180