/** * {@inheritdoc} */ public function configure(DataGridInterface $datagrid) { $datagrid->setIdentifier($this->identifier); $eventHandlers = $this->manager->getOptions()->getEventHandlers(); $eventHandlers->add(new LoadEventHandler(['function' => $this->getFunction('load'), 'route' => $this->manager->getRouteForAction('grid')])); $eventHandlers->add(new EditRowEventHandler(['function' => $this->getFunction('edit'), 'row_action' => OptionInterface::ACTION_EDIT, 'route' => $this->manager->getRouteForAction('edit')])); $eventHandlers->add(new ClickRowEventHandler(['function' => $this->getFunction('click'), 'route' => $this->manager->getRouteForAction('edit')])); $eventHandlers->add(new DeleteRowEventHandler(['function' => $this->getFunction('delete'), 'row_action' => OptionInterface::ACTION_DELETE, 'route' => $this->manager->getRouteForAction('delete')])); $datagrid->setRepository($this->repository); $datagrid->setManager($this->manager); }
/** * Boots DataGrid if it was not booted * * @return void */ public function boot() { $columnCollection = $this->manager->getColumnCollection(); // adds new columns do collection $this->addColumns($columnCollection); // sets columns for current datagrid $this->setColumns($columnCollection); $this->setOptions($this->manager->getOptions()); $this->booted = true; }