Skip to content
PHP Ecosystem
Explore

SerialColumn

API reference › CSV Export › SerialColumn

classyii2\extensions\csvexport\SerialColumn
ExtendsColumn » yii\base\BaseObject
Implementsyii\base\Configurable
Sourcesrc/SerialColumn.php

SerialColumn displays a column of row numbers (1-based).

PropertyTypeDescriptionDefined by
$contentcallable(mixed, mixed, int, Column): mixed|nullThis is a callable that will be used to generate the content of each cell. Default: null.Column
$footerstring|nullFooter cell content, or null to use the exporter fallback. Default: null.Column
$gridCsvExporterThe exporter that owns this column.Column
$headerstring|nullThe header for the serial column. Default: '#'.SerialColumn
$visibleboolWhether this column is visible. Defaults to true. Default: true.Column
MethodDescriptionDefined by
__construct()Constructor.yii\base\BaseObject
__call()Calls the named method which is not a class method.yii\base\BaseObject
__get()Returns the value of an object property.yii\base\BaseObject
__isset()Checks if a property is set, i.e. defined and not null.yii\base\BaseObject
__set()Sets value of an object property.yii\base\BaseObject
__unset()Sets an object property to null.yii\base\BaseObject
canGetProperty()Returns a value indicating whether a property can be read.yii\base\BaseObject
canSetProperty()Returns a value indicating whether a property can be set.yii\base\BaseObject
className() staticReturns the fully qualified name of this class.yii\base\BaseObject
getGrid()Returns the exporter that owns this column.Column
hasMethod()Returns a value indicating whether a method is defined.yii\base\BaseObject
hasProperty()Returns a value indicating whether a property is defined.yii\base\BaseObject
init()Initializes the object.yii\base\BaseObject
renderDataCellContent()Renders the one-based row number.SerialColumn
renderFooterCellContent()Renders the footer cell using configured text or the exporter fallback.Column
renderHeaderCellContent()Renders the header cell using configured text or the exporter fallback.Column
setGrid()Sets the exporter that owns this column.Column
public function renderDataCellContent(mixed $model, mixed $key, int $index): int

Renders the one-based row number.

Parameters

ParameterTypeDescription
$modelmixedData row; not used.
$keymixedKey associated with the data row; not used.
$indexintZero-based row index across the export.

Returns

int: The row number, starting at 1 and continuing across batches and files.