当前位置:Gxlcms > PHP教程 > yii2.0GridView-自定义按钮跟链接

yii2.0GridView-自定义按钮跟链接

时间:2021-07-01 10:21:17 帮助过:8人阅读

yii 2.0 GridView-自定义按钮和链接

直接贴代码吧:

widget([        'dataProvider' => $dataProvider,        //'filterModel' => $searchModel,        'columns' => [            ['class' => 'yii\grid\SerialColumn'],            //显示的字段            //code的值            ['attribute'=>'这是测试code','value'=>function(){return 'abc';}],            'name',            'population',                        ['class' => 'yii\grid\ActionColumn','header' => '操作',],            [                'label'=>'更多操作',                'format'=>'raw',                'value' => function($data){                    $url = "http://www.baidu.com";                    return Html::a('添加权限组', $url, ['title' => '审核']);                 }            ]                ],    ]); ?>

效果如图:

人气教程排行