首页  >  文章  >  后端开发  >  yii 2.0 GridView-自定义按钮和链接,yiigridview-_PHP教程

yii 2.0 GridView-自定义按钮和链接,yiigridview-_PHP教程

WBOY
WBOY原创
2016-07-13 10:11:401038浏览

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

直接贴代码吧:

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

效果如图:

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/927469.htmlTechArticleyii 2.0 GridView-自定义按钮和链接,yiigridview- 直接贴代码吧: ?= GridView:: widget([ 'dataProvider' = $dataProvider , // 'filterModel' = $searchModel, 'columns' =...
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn