Skip to content
PHP Ecosystem
Explore

GridColumn

API reference › Yii3 Debug › Web › GridColumn

final readonly classYii3\Debug\Web\GridColumn
ImplementsYiisoft\Yii\DataView\GridView\Column\ColumnInterface
Sourcesrc/Web/GridColumn.php

Represents a panel grid column with pre-rendered header and filter content and a per-row body-content callback.

PropertyTypeDescriptionDefined by
$bodyClass readonly constructorstring|nullExtra CSS class for the body cells only, or null for none. Default: null.GridColumn
$class readonly constructorstring|nullCSS class shared by the header, filter, and body cells, or null for none. Default: null.GridColumn
$content readonly constructorClosure(Yii3\Debug\Web\TRow, Yiisoft\Yii\DataView\GridView\Column\Base\DataContext): stringBuilds the body cell content for one row.GridColumn
$encodeContent readonly constructorboolWhether the body content is plain text that the cell must encode. Default: false.GridColumn
$filter readonly constructorstring|Stringable|nullFilter cell content; null renders no filter cell at all, '' renders an empty cell that keeps the column class. Default: null.GridColumn
$header readonly constructorstring|PHPForge\Debug\View\Grid\SortHeaderHeader cell HTML, already rendered and encoded by the caller, or the header cell of a sortable column.GridColumn
$headerClass readonly constructorstring|nullExtra CSS class for the header cell only, or null for none. Default: null.GridColumn
MethodDescriptionDefined by
__construct()Creates a grid-column definition from a header, a row-content callback, and presentation options.GridColumn
getRenderer()Returns the renderer GridView resolves this column through.GridColumn
isVisible()Returns whether the column renders.GridColumn
public function __construct(string|PHPForge\Debug\View\Grid\SortHeader $header, Closure(Yii3\Debug\Web\TRow, Yiisoft\Yii\DataView\GridView\Column\Base\DataContext): string $content, string|Stringable|null $filter = null, bool $encodeContent = false, string|null $class = null, string|null $headerClass = null, string|null $bodyClass = null)

Creates a grid-column definition from a header, a row-content callback, and presentation options.

Parameters

ParameterTypeDescription
$headerstring|PHPForge\Debug\View\Grid\SortHeaderHeader cell HTML, already rendered and encoded by the caller, or the header cell of a sortable column.
$contentClosure(Yii3\Debug\Web\TRow, Yiisoft\Yii\DataView\GridView\Column\Base\DataContext): stringBuilds the body cell content for one row.
$filterstring|Stringable|nullFilter cell content; null renders no filter cell at all, '' renders an empty cell that keeps the column class.
$encodeContentboolWhether the body content is plain text that the cell must encode.
$classstring|nullCSS class shared by the header, filter, and body cells, or null for none.
$headerClassstring|nullExtra CSS class for the header cell only, or null for none.
$bodyClassstring|nullExtra CSS class for the body cells only, or null for none.
public function getRenderer(): class-string<Yii3\Debug\Web\GridColumnRenderer>

Returns the renderer GridView resolves this column through.

Returns

class-string<GridColumnRenderer>: Renderer class GridView instantiates for this column.

public function isVisible(): bool

Returns whether the column renders.

Returns

bool: true when the column renders; false when it is hidden.