/** * @param \SpoonDatagridSource $source */ public function __construct(\SpoonDatagridSource $source) { parent::__construct($source); // set debugmode, this will force the recompile for the used templates $this->setDebug(BackendModel::getContainer()->getParameter('kernel.debug')); // set the compile-directory, so compiled templates will be in a folder that is writable $this->setCompileDirectory(BACKEND_CACHE_PATH . '/CompiledTemplates'); // set attributes for the datagrid $this->setAttributes(array('class' => 'table table-hover table-striped fork-data-grid jsDataGrid')); // id gets special treatment if (in_array('id', $this->getColumns())) { // hide the id by defaults $this->setColumnsHidden('id'); // our JS needs to know an id, so we can highlight it $this->setRowAttributes(array('id' => 'row-[id]')); } // set default sorting options $this->setSortingOptions(); // add classes on headers foreach ($this->getColumns() as $column) { // set class $this->setColumnHeaderAttributes($column, array('class' => $column)); // set default label $this->setHeaderLabels(array($column => \SpoonFilter::ucfirst(BackendLanguage::lbl(\SpoonFilter::toCamelCase($column))))); } // set paging class $this->setPagingClass('Backend\\Core\\Engine\\DataGridPaging'); // set default template $this->setTemplate(BACKEND_CORE_PATH . '/Layout/Templates/Datagrid.tpl'); }
/** * @param SpoonDataGridSource $source */ public function __construct(SpoonDataGridSource $source) { parent::__construct($source); // set debugmode, this will force the recompile for the used templates $this->setDebug(SPOON_DEBUG); // set the compile-directory, so compiled templates will be in a folder that is writable $this->setCompileDirectory(BACKEND_CACHE_PATH . '/compiled_templates'); // set attributes for the datagrid $this->setAttributes(array('class' => 'dataGrid', 'cellspacing' => 0, 'cellpadding' => 0, 'border' => 0)); // id gets special treatment if (in_array('id', $this->getColumns())) { // hide the id by defaults $this->setColumnsHidden('id'); // our JS needs to know an id, so we can highlight it $this->setRowAttributes(array('id' => 'row-[id]')); } // set default sorting options $this->setSortingOptions(); // add classes on headers foreach ($this->getColumns() as $column) { // set class $this->setColumnHeaderAttributes($column, array('class' => $column)); // set default label $this->setHeaderLabels(array($column => SpoonFilter::ucfirst(BL::lbl(SpoonFilter::toCamelCase($column))))); } // set paging class $this->setPagingClass('BackendDataGridPaging'); // set default template $this->setTemplate(BACKEND_CORE_PATH . '/layout/templates/datagrid.tpl'); }