yii2.0之GridView自定义按钮和链接用法

复制代码 代码如下:


<?= 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' => '审核']);
                }
            ]       
        ],
    ]); ?>


运行效果如下图所示:

yii2.0之GridView自定义按钮和链接用法

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/c02ac417298e981fad8ae0eae2cb9aea.html