Home  >  Article  >  Backend Development  >  yii2 gridview whether to display a certain column case gridview control uses gridview paging what is gridview

yii2 gridview whether to display a certain column case gridview control uses gridview paging what is gridview

WBOY
WBOYOriginal
2016-07-29 08:52:311326browse

Author: Bailang Source: http://www.manks.top/article/yii2_gridview_visible

The copyright of this article belongs to the author. Reprinting is welcome, but this statement must be retained without the author's consent, and the original text must be given in a prominent position on the article page connection, otherwise we reserve the right to pursue legal liability.

Let’s take a simple case

Condition: There is a get parameter type

Requirement: Only when the value of type is equal to 1, the column name will be displayed, otherwise the column will not be displayed

The code is implemented as follows:

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

The implementation method is also very simple.

The above introduces the case of whether yii2 gridview displays a certain column, including the content of GRIDVIEW. I hope it will be helpful to friends who are interested in PHP tutorials.

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