This article mainly introduces the usage of custom buttons and links in the GridView of yii2.0. it is a very practical form operation technique using the GridView, for more information about how to use custom buttons and links in the GridView of yii2.0, see the following example. Share it with you for your reference. The specific implementation method is as follows:
The code is as follows:
<? = GridView: widget ([
'Dataprovider' => $ dataProvider,
// 'Filtermodel' => $ searchModel,
'Columns '=> [
['Class' => 'yii \ grid \ SerialColumn '],
// Fields displayed
// Code value
['Attribute' => 'this is the test code', 'value' => function () {return 'abc';}],
'Name ',
'Population ',
['Class' => 'yii \ grid \ actioncolumn', 'header' => 'operation',],
[
'Label' => 'More operations ',
'Format' => 'raw ',
'Value' => function ($ data ){
$ Url = "http://www.baidu.com ";
Return Html: a ('add permission group', $ url, ['title' => 'review']);
}
]
],
]);?>
Shows the running effect:
I hope this article will help you design PHP programs based on the Yii Framework.