public function init() { if (!$this->name) { throw new CException('You should provide name for TbEditableColumn'); } parent::init(); /** * add a dummy object to the data provider and call render function to allow register * required scripts if grid was initially empty... */ if (empty($this->grid->dataProvider->data)) { if ($this->grid->dataProvider instanceof CActiveDataProvider) { $dummy = new $this->grid->dataProvider->modelClass(); } else { if ($this->grid->dataProvider instanceof CArrayDataProvider) { $keys = $this->fetchKeys($this->grid->dataProvider); $dummy = array(); foreach ($keys as $key) { $dummy[$key] = $key; // anyvalue; } } else { $dummy = null; } } $this->grid->dataProvider->data = array($dummy); $this->editable['htmlOptions'] = array('style' => 'display: none;'); $this->renderDataCellContent(0, $dummy); // this is the target line $this->grid->dataProvider->data = array(); } //need to attach ajaxUpdate handler to refresh editables on pagination and sort TbEditable::attachAjaxUpdateEvent($this->grid); }
public function init() { if (!$this->name) { throw new CException('You should provide name for TbEditableColumn'); } parent::init(); //need to attach ajaxUpdate handler to refresh editables on pagination and sort TbEditable::attachAjaxUpdateEvent($this->grid); }