Home  >  Article  >  Backend Development  >  How to use custom buttons and links in GridView in yii2.0, yii2.0gridview_PHP tutorial

How to use custom buttons and links in GridView in yii2.0, yii2.0gridview_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:11:37893browse

Yii2.0 GridView custom button and link usage, yii2.0gridview

The example in this article describes the usage of GridView custom buttons and links in yii2.0. Share it with everyone for your reference. The specific implementation method is as follows:

Copy code The code is as follows:

'dataProvider' => $dataProvider,
//'filterModel' => $searchModel,
         'columns' => [
                ['class' => 'yiigridSerialColumn'],
//Displayed fields
//code value
                ['attribute'=>'This is the test code','value'=>function(){return 'abc';}],
             'name',
            'population',
                                                                                      ['class' => 'yiigridActionColumn','header' => 'Action',],
                                             [
               'label'=>'More operations',
               'format'=>'raw',
                 'value' => function($data){
                           $url = "http://www.baidu.com";
                            return Html::a('Add permission group', $url, ['title' => 'Audit']);
                }
                                                                                                   ],
]); ?>


The running effect is shown in the figure below:

I hope this article will be helpful to everyone’s PHP program design based on the Yii framework.

http://www.bkjia.com/PHPjc/928226.html

truehttp: //www.bkjia.com/PHPjc/928226.htmlTechArticleGridView custom buttons and link usage in yii2.0, yii2.0gridview This article describes the GridView in yii2.0 with examples Custom button and link usage. Share it with everyone for your reference. Specific implementation method...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn