SerialColumn
API reference › CSV Export › SerialColumn
SerialColumn displays a column of row numbers (1-based).
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$content | callable(mixed, Column): mixed| | This is a callable that will be used to generate the content of each cell. Default: null. | Column |
$footer | string| | Footer cell content, or null to use the exporter fallback. Default: null. | Column |
$grid | CsvExporter | The exporter that owns this column. | Column |
$header | string| | The header for the serial column. Default: '#'. | SerialColumn |
$visible | bool | Whether this column is visible. Defaults to true. Default: true. | Column |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Constructor. | yii\ |
__call() | Calls the named method which is not a class method. | yii\ |
__get() | Returns the value of an object property. | yii\ |
__isset() | Checks if a property is set, i.e. defined and not null. | yii\ |
__set() | Sets value of an object property. | yii\ |
__unset() | Sets an object property to null. | yii\ |
canGetProperty() | Returns a value indicating whether a property can be read. | yii\ |
canSetProperty() | Returns a value indicating whether a property can be set. | yii\ |
className() static | Returns the fully qualified name of this class. | yii\ |
getGrid() | Returns the exporter that owns this column. | Column |
hasMethod() | Returns a value indicating whether a method is defined. | yii\ |
hasProperty() | Returns a value indicating whether a property is defined. | yii\ |
init() | Initializes the object. | yii\ |
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 |
Method details
Section titled “Method details”renderDataCellContent()
Section titled “renderDataCellContent() ”public function renderDataCellContent(mixed $model, mixed $key, int $index): intRenders the one-based row number.
Parameters
| Parameter | Type | Description |
|---|---|---|
$model | mixed | Data row; not used. |
$key | mixed | Key associated with the data row; not used. |
$index | int | Zero-based row index across the export. |
Returns
int: The row number, starting at 1 and continuing across batches and files.