您的位置:首页 > 编程语言 > PHP开发

Yii2.0 GridView 新增添加按钮

2016-11-10 16:38 89 查看
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],

'id',
'parent',
'lft',
'rht',
'name',
['class' => 'yii\grid\ActionColumn','header'=>'操作','template' => '{add} {view} {update} {delete}',
'buttons' => [
'add' => function ($url, $model, $key) {
return  Html::a('<span class="glyphicon glyphicon-plus  btn btn-warning btn-sm"></span>', $url, ['title' => '添加'] ) ;
},
],
'headerOptions' => ['width' => '180']
],
],
]); ?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: