GridColumn
API reference › Yii3 Debug › Web › GridColumn
Represents a panel grid column with pre-rendered header and filter content and a per-row body-content callback.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$bodyClass readonly constructor | string| | Extra CSS class for the body cells only, or null for none. Default: null. | GridColumn |
$class readonly constructor | string| | CSS class shared by the header, filter, and body cells, or null for none. Default: null. | GridColumn |
$content readonly constructor | Closure(Yii3\ | Builds the body cell content for one row. | GridColumn |
$encodeContent readonly constructor | bool | Whether the body content is plain text that the cell must encode. Default: false. | GridColumn |
$filter readonly constructor | string|Stringable| | Filter cell content; null renders no filter cell at all, '' renders an empty cell that keeps the column class. Default: null. | GridColumn |
$header readonly constructor | string| | Header cell HTML, already rendered and encoded by the caller, or the header cell of a sortable column. | GridColumn |
$headerClass readonly constructor | string| | Extra CSS class for the header cell only, or null for none. Default: null. | GridColumn |
Methods
Section titled “Methods”| Method | Description | Defined 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 |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”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
| Parameter | Type | Description |
|---|---|---|
$header | string| | Header cell HTML, already rendered and encoded by the caller, or the header cell of a sortable column. |
$content | Closure(Yii3\ | Builds the body cell content for one row. |
$filter | string|Stringable| | Filter cell content; null renders no filter cell at all, '' renders an empty cell that keeps the column class. |
$encodeContent | bool | Whether the body content is plain text that the cell must encode. |
$class | string| | CSS class shared by the header, filter, and body cells, or null for none. |
$headerClass | string| | Extra CSS class for the header cell only, or null for none. |
$bodyClass | string| | Extra CSS class for the body cells only, or null for none. |
getRenderer()
Section titled “getRenderer() ”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.
isVisible()
Section titled “isVisible() ”public function isVisible(): boolReturns whether the column renders.
Returns
bool: true when the column renders; false when it is hidden.