Fill the rest of the row with empty cells

@throws  InvalidArgumentException
@return String $html
199576
protected function fillWithEmptyCells($table_row,$tag_row)
  {
    $html = '';

    if( ! ($table_row instanceof TableLine) )
    {
      throw new \InvalidArgumentException;
    }

    $length_row = $table_row->getLength();
    $diff = $this->max_length_rows - $length_row;

    if( $diff > 0 )
    {
      // add empty cells
      foreach( range(1,$diff) as $key)
      {
        $html.="\t\t\t<{$tag_row}></{$tag_row}>\n";
      }
    }

    $html.="\t\t</tr>\n";

    return $html;
  }
1062144
public function formatRow()
    {
        // execute CompleteLister row formating
        parent::formatRow();

        if (empty($this->columns)) {
            throw $this->exception('No columns defined for grid');
        }

        foreach ($this->columns as $field => $column) {
            if ((is_array($this->current_row) || $this->current_row instanceof ArrayAccess)
                && array_key_exists($field, $this->current_row)
            ) {
                $this->current_row[$field.'_original'] = $this->current_row[$field];
            }

            // if model field has listData structure, then get value instead of key
            if ($this->model && $f = $this->model->hasElement($field)) {
                $v = $this->current_row[$field];

                if ($this->model instanceof \atk4\data\Model) {
                    /** @type \atk4\data\Field $f */
                    if (isset($f->enum) && $values = $f->enum) {
                        $this->current_row[$field] = isset($f->ui['valueList'][$v])
                            ? $f->ui['valueList'][$v]
                            : $values[$v];
                    }
                } else {
                    /** @type Field $f */
                    if ($f->type() !== 'boolean' && $values = $f->listData()) {
                        $this->current_row[$field] = $values[$v];
                    }
                }
            }

            // process formatters
            $this->executeFormatters($field, $column, 'format_');

            // setting cell parameters (tdparam)
            $this->applyTDParams($field);
        }
    }
1090670
public function getTableAsString()
    {
        $lines = array();
        for ($i = 0; $i < count($this->getRows()); $i++) {
            $lines[] = $this->getRowAsString($i);
        }

        return implode("\n", $lines);
    }
129515
public function toHtml(array $row)
    {
        if ($this->getLabel() == '') {
            throw new \InvalidArgumentException(
                'A label is required for this action type, please call $action->setLabel()!'
            );
        }

        $label = $this->getLabel();
        if ($label instanceof AbstractColumn) {
            $label = $row[$label->getUniqueId()];
        }

        return '<a '.$this->getAttributesString($row).'>'.$label.'</a>';
    }
1289050
protected function fillDataForEmpty()
    {
        // Fill field references if they are empty
        $fields = [];

        // Add columns for attributes
        foreach ($this->info->attributes as $attribute) {

            if ($attribute->hidden || ! $this->shouldAttributeBeEditableByDefault($attribute, $this->info)) {
                continue;
            }

            $fields[ $attribute->name ] = $this->makeModelFormFieldDataForAttributeData($attribute);
        }


        // Add fields for relations
        foreach ($this->info->relations as $relation) {

            $fields[ $relation->name ] = $this->makeModelFormFieldDataForRelationData($relation);
        }


        $this->info->form->fields = $fields;
    }
897949
public function html()
    {
        $script = "var formData = $(\"select.searchable\").serializeArray(); $.each(formData, function(i, o){data[o.name] = o.value;});";

        return $this->builder()
                    ->columns($this->getColumns())
                    ->minifiedAjax('', $script)
                    ->parameters($this->getBuilderParameters());
    }
12523
public function Fill()
	{
		if ( $this->src->getIsFinished() ) return;

		foreach ( $this->src as $fact )
		{
			$this->buffer[] = $fact;
		}
		// while ( $this->src->MoveNext() )
		// {
		// 	$this->buffer[] = $this->src->getCurrent();
		// }

		$this->filled = true;
		$this->empty = ! count( $this->buffer );
	}
821731
public function createRow()
    {
        $row = new Row();

        $this->childNodes->push($row);

        return $this->childNodes->last();
    }
1240445
public function renderEmpty()
    {
        $options = $this->emptyTextOptions;
        $tag = ArrayHelper::remove($options, 'tag', 'div');
        return Html::tag($tag, $this->emptyText, $options);
    }
668079
public function setRows(int $amount)
    {
        if (!$amount) {
            throw new InvalidArgumentException('Rows amount must be set');
        }

        if ($this->rows === $amount) {
            return $this;
        }

        if ($this->rows < $amount) {
            // Add rows
            for ($i = $amount - $this->rows; $i > 0; $i--) {
                $this->structure[] = $this->columns ? array_fill(0, $this->columns, $this->cell_example) : [];
            }
        } else {
            // Remove rows from the end
            $this->structure = \array_slice($this->structure, 0, $amount);
        }

        $this->rows = $amount;

        return $this;
    }
1334819
public function renderDataCell($row)
	{
		if ($this->grid->json) {
            $data = $this->grid->dataProvider->data[$row];
            $options = $this->htmlOptions;
            if ($this->cssClassExpression !== null) {
                $class = $this->evaluateExpression($this->cssClassExpression, array('row' => $row, 'data' => $data));
                if (!empty($class)) {
                    if (isset($options['class'])) {
                        $options['class'] .= ' ' . $class;
                    } else {
                        $options['class'] = $class;
                    }
                }
            }

            return array(
                'attrs' => CHtml::renderAttributes($options),
                'content' => $this->renderDataCellContent($row, $data),
            );
		}

		parent::renderDataCell($row);
	}
18916
protected function processRowsHeads() {
        $cols = $this->getCols();
        $this->data = $this->rows;
        if (!empty($cols)) {
            array_unshift($this->data, $cols);
        }
        return $this->data;
    }
734669
protected function fillDataForEmpty()
    {
        // Fill list references if they are empty
        $columns = [];

        // Add columns for attributes
        foreach ($this->info->attributes as $attribute) {

            if ($attribute->hidden || ! $this->shouldAttributeBeDisplayedByDefault($attribute, $this->info)) {
                continue;
            }

            $columns[ $attribute->name ] = $this->makeModelListColumnDataForAttributeData($attribute, $this->info);
        }

        // Add columns for relations?
        // Perhaps, though it may be fine to leave this up to manual configuration.
        // todo: consider


        $this->info->list->columns = $columns;
    }
444964
public function renderHeaderCell()
	{
		if ($this->grid->json) {
			ob_start();
			$this->renderHeaderCellContent();
			$content = ob_get_contents();
			ob_end_clean();

			return array('id' => $this->id, 'content' => $content);
		}
		parent::renderHeaderCell();
		return array();
	}
1173878
public function getRowAndColumnCount()
    {
        $rows = $columns = 0;
        $trs = $this->getElementsByTagName('tr');
        foreach ($trs as $tr) {
            /** @var \DOMElement $tr */
            $rowspan = $tr->getAttribute('rowspan');
            $rows += ($rowspan || 1);

            // Now look for column-related info
            $columnsInThisRow = 0;
            $cells = $tr->getElementsByTagName('td');
            foreach ($cells as $cell) {
                /** @var \DOMElement $cell */
                $colspan = $cell->getAttribute('colspan');
                $columnsInThisRow += ($colspan || 1);
            }
            $columns = max($columns, $columnsInThisRow);
        }

        return ['rows' => $rows, 'columns' => $columns];
    }
537192
protected function get_RowsInnerHtml() {
    $rowsInnerHtml = [];
    foreach ($this->MatrixCells as $rowIndex => $rowCells) {
      $rowInnerHtml = '';
      foreach ($rowCells as $colIndex => $cell) {
        $rowInnerHtml .= $cell->render();
      }
      $rowsInnerHtml[$rowIndex] = $rowInnerHtml;
    }
    return $rowsInnerHtml;
  }
968328
private function splitCellsContent()
    {
        // For each row...
        foreach ($this->data as $rowPosition => $rowContent) {
            // ... cycle each column to get its content
            foreach ($rowContent as $columnName => $cellContent) {
                // Remove extra spaces from the string
                $cellContent = $this->reduceSpaces($cellContent);

                // If we don't have a max width set for the column...
                if (false === isset($this->options['columns'][$columnName]['max_width'])) {
                    // ... simply wrap the content in an array and continue
                    $this->data[$rowPosition][$columnName] = [$cellContent];
                    goto addVerticalPadding;
                }

                // ... We have a max_width set: split the column
                $length = $this->options['columns'][$columnName]['max_width'];
                $cut    = $this->options['columns'][$columnName]['cut'];

                $wrapped = wordwrap($cellContent, $length, PHP_EOL, $cut);

                $this->data[$rowPosition][$columnName] = explode(PHP_EOL, $wrapped);

                // At the end, add the vertical padding to the cell's content
                addVerticalPadding:
                if (0 < $this->options['cells_padding'][0]) {
                    // Now add the top padding
                    for ($paddingLine = 0; $paddingLine < $this->options['cells_padding'][0]; ++$paddingLine) {
                        array_unshift($this->data[$rowPosition][$columnName], '');
                    }
                }

                if (0 < $this->options['cells_padding'][2]) {
                    // And the bottom padding
                    for ($paddingLine = 0; $paddingLine < $this->options['cells_padding'][2]; ++$paddingLine) {
                        array_push($this->data[$rowPosition][$columnName], '');
                    }
                }
            }
        }
    }