kartik\export\ExportMenu::generateRow PHP Method

generateRow() public method

Generates an output data row with the given data model and key.
public generateRow ( mixed $model, mixed $key, integer $index ) : void
$model mixed the data model to be rendered
$key mixed the key associated with the data model
$index integer the zero-based index of the data model among the model array returned by [[dataProvider]].
return void
    public function generateRow($model, $key, $index)
    {
        /**
         * @var Column $column
         */
        $this->_endCol = 0;
        foreach ($this->getVisibleColumns() as $column) {
            if ($column instanceof SerialColumn) {
                $value = $column->renderDataCell($model, $key, $index);
            } elseif ($column instanceof ActionColumn) {
                $value = '';
            } else {
                $format = $this->enableFormatter && isset($column->format) ? $column->format : 'raw';
                $value = $column->content === null ? method_exists($column, 'getDataCellValue') ? $this->formatter->format($column->getDataCellValue($model, $key, $index), $format) : $column->renderDataCell($model, $key, $index) : call_user_func($column->content, $model, $key, $index, $column);
            }
            if (empty($value) && !empty($column->attribute) && $column->attribute !== null) {
                $value = ArrayHelper::getValue($model, $column->attribute, '');
            }
            $this->_endCol++;
            $cell = $this->_objPHPExcelSheet->setCellValue(self::columnName($this->_endCol) . ($index + $this->_beginRow + 1), empty($value) && !strlen($value) ? '' : strip_tags($value), true);
            $this->raiseEvent('onRenderDataCell', [$cell, $value, $model, $key, $index, $this]);
        }
    }