Use custom buttons and links in the GridView of yii2.0, yii2.0gridview _ PHP Tutorial

Source: Internet
Author: User
Use the custom button and link in the GridView of yii2.0, yii2.0gridview. Yii2.0 uses the custom buttons and links in the GridView. the examples in this article describe the usage of the custom buttons and links in the GridView of yii2.0. Share it with you for your reference. The specific implementation method is yii2.0's GridView custom button and link usage, yii2.0gridview

This article describes the usage of the custom buttons and links in the GridView of yii2.0. 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.

Examples in this article describes how to use the custom buttons and links of the GridView in yii2.0. Share it with you for your reference. Implementation...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.