/** * Initializes the grid view. * This method will initialize required property values and instantiate [[columns]] objects. */ public function init() { $this->dataColumnClass = DataColumn::className(); $this->summaryOptions = ['class' => 'summary well well-sm pull-left margin-bottom-10px']; $this->layout = '{summary}<div class="clearfix"></div>{pager}{items}{pager}'; $this->showFooter = true; $this->options = ArrayHelper::merge($this->options, ['class' => 'grid-view table-responsive']); $this->pager = ['class' => LinkPager::className()]; parent::init(); }
/** * We should use this when we add a new row, because that new row created like other rows */ protected function initOtherRowColumns() { if (!empty($this->otherRowColumns)) { foreach ($this->otherRowColumns as $i => $column) { if (is_string($column)) { $column = $this->createDataColumn($column); } else { $column = Yii::createObject(array_merge(['class' => $this->dataColumnClass ?: DataColumn::className(), 'grid' => $this], $column)); } if (!$column->visible) { unset($this->otherRowColumns[$i]); continue; } $this->otherRowColumns[$i] = $column; } } }