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

WBOY
Release: 2016-07-13 10:11:37
Original
946 people have browsed it

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...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!