Home >php教程 >php手册 >yii2 gridview 是否显示某列案例,yii2gridview

yii2 gridview 是否显示某列案例,yii2gridview

WBOY
WBOYOriginal
2016-06-13 08:41:19789browse

yii2 gridview 是否显示某列案例,yii2gridview

作者:白狼 出处:http://www.manks.top/article/yii2_gridview_visible

本文版权归作者,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

我们举一个简单的案例

条件:有一个get形参数type

需求:仅且type的值等于1的时候,列name才显示,否则该列不显示

代码实现如下:

<span>[
    </span>'attribute' => 'name',
    'value' => <span>$model</span>->name,
    'visible' => <span>intval</span>(Yii::<span>$app</span>->request->get('type')) == 1,<span>
]</span>,

 

实现方式也是很简单滴。

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