Home Backend Development PHP Tutorial yii 2.0 GridView-自定义按钮跟链接

yii 2.0 GridView-自定义按钮跟链接

Jun 13, 2016 pm 12:11 PM
function gt return

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

直接贴代码吧:

1

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

Copy after login

效果如图:

 

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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What are the differences between Huawei GT3 Pro and GT4? What are the differences between Huawei GT3 Pro and GT4? Dec 29, 2023 pm 02:27 PM

What are the differences between Huawei GT3 Pro and GT4?

Detailed explanation of the usage of return in C language Detailed explanation of the usage of return in C language Oct 07, 2023 am 10:58 AM

Detailed explanation of the usage of return in C language

What does function mean? What does function mean? Aug 04, 2023 am 10:33 AM

What does function mean?

Fix: Snipping tool not working in Windows 11 Fix: Snipping tool not working in Windows 11 Aug 24, 2023 am 09:48 AM

Fix: Snipping tool not working in Windows 11

What is the execution order of return and finally statements in Java? What is the execution order of return and finally statements in Java? Apr 25, 2023 pm 07:55 PM

What is the execution order of return and finally statements in Java?

How to Fix Can't Connect to App Store Error on iPhone How to Fix Can't Connect to App Store Error on iPhone Jul 29, 2023 am 08:22 AM

How to Fix Can't Connect to App Store Error on iPhone

What is the purpose of the 'enumerate()' function in Python? What is the purpose of the 'enumerate()' function in Python? Sep 01, 2023 am 11:29 AM

What is the purpose of the 'enumerate()' function in Python?

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决

See all articles