/** * Provides complete datagrid rendering. * @param DataGrid * @param string * @return string */ public function render(DataGrid $dataGrid, $mode = NULL) { if ($this->dataGrid !== $dataGrid) { $this->dataGrid = $dataGrid; } if (!$dataGrid->dataSource instanceof DibiDataSource) { throw new InvalidArgumentException("Data source was not setted. You must set data source to data grid before rendering."); } if ($mode !== NULL) { return call_user_func_array(array($this, 'render' . $mode), array()); } $template = $this->dataGrid->getTemplate(); $template->setFile($this->file); return $template->__toString(TRUE); }