/** * Add a Column to the DataGrid * @param $object A TDataGridColumn object */ public function addColumn(TDataGridColumn $column) { $renderers = $column->get_cell_renderers(); $cell_renderer = $renderers[0]; $column->add_attribute($cell_renderer, 'text', $this->count); $column->set_cell_data_func($cell_renderer, array($this, 'formatZebra')); $this->view->append_column($column); $this->types[] = GObject::TYPE_STRING; $this->columns[] = $column; if ($column->getWidth()) { $this->width += $column->getWidth(); $width = $this->width + count($this->columns) * 10; $this->view->set_size_request($width, -1); } $this->count++; }
/** * Add a Column to the DataGrid * @param $object A TDataGridColumn object */ public function addColumn(TDataGridColumn $column) { if ($this->modelCreated) { throw new Exception(TAdiantiCoreTranslator::translate('You must call ^1 before ^2', __METHOD__, 'createModel')); } else { $renderers = $column->get_cell_renderers(); $cell_renderer = $renderers[0]; $column->add_attribute($cell_renderer, 'text', $this->count); $column->set_cell_data_func($cell_renderer, array($this, 'formatZebra')); $this->view->append_column($column); $this->types[] = GObject::TYPE_STRING; $this->columns[] = $column; if ($column->getWidth()) { $this->width += $column->getWidth(); $width = $this->width + count($this->columns) * 10; $this->view->set_size_request($width, -1); } $this->count++; } }