/** * Sets route parameters for grid actions without ID * * @author Ćukasz Wawrzyniak <*****@*****.**> * @param \TMSolution\DataGridBundle\Grid\Action\RowAction $actionObject * @param string $entityName * @return \TMSolution\DataGridBundle\Grid\Action\RowAction */ protected function setGridActionRouteParametersWithout(\TMSolution\DataGridBundle\Grid\Action\RowAction $actionObject, $action, $entityName = null) { if ($entityName === null) { $actionObject->setRouteParameters(array('entityName' => $entityName, 'action' => $action, 'id')); } else { $actionObject->setRouteParameters(array('action' => $action, 'id')); } return $actionObject; }
protected function configureRowButton($grid, $routePrefix) { $parametersArr = $this->request->attributes->all(); $parameters = ["id", "containerName" => "container", "actionId" => "default"]; $parameters = array_merge($parametersArr["_route_params"], $parameters); $rowAction = new RowAction('glyphicon glyphicon-eye-open', $routePrefix . '_view', false, null, ['id' => 'button-id', 'class' => 'button-class lazy-loaded', 'data-original-title' => 'View', 'data-route-target' => '.content']); $rowAction->setRouteParameters($parameters); $grid->addRowAction($rowAction); /* $rowAction = new RowAction('glyphicon glyphicon-edit', $routePrefix . '_update', false, null, ['id' => 'button-id', 'class' => 'button-class lazy-loaded', 'data-original-title' => 'Edit']); $rowAction->setRouteParameters($parameters); $grid->addRowAction($rowAction);*/ $rowAction = new RowAction('glyphicon glyphicon-remove', $routePrefix . '_delete', false, null, ['id' => 'button-id', 'class' => 'button-class grid-button-delete', 'data-original-title' => 'Delete']); $rowAction->setRouteParameters($parameters); $grid->addRowAction($rowAction); }
protected function configureRowButton($grid, $routePrefix) { /* @todo, aftert test - add to oryginal data-grid command generator */ $parametersArr = $this->request->attributes->all(); $parameters = ["id", "containerName" => "container", "prefix" => "default"]; $parameters = array_merge($parameters, $parametersArr["_route_params"]); $parentId = $this->request->get("parentId"); $parentName = $this->request->get("parentName"); $rowAction = new RowAction('glyphicon glyphicon-eye-open', $routePrefix . '_read', false, null, ['id' => 'button-id', 'class' => 'button-class lazy-loaded', 'data-original-title' => 'Show']); $rowAction->setRouteParameters($parameters); $grid->addRowAction($rowAction); $rowAction = new RowAction('glyphicon glyphicon-edit', $routePrefix . '_update', false, null, ['id' => 'button-id', 'class' => 'button-class lazy-loaded', 'data-original-title' => 'Edit']); $rowAction->setRouteParameters($parameters); $grid->addRowAction($rowAction); $rowAction = new RowAction('glyphicon glyphicon-remove', $routePrefix . '_delete', false, null, ['id' => 'button-id', 'class' => 'button-class lazy-loaded', 'data-original-title' => 'Delete']); $rowAction->setRouteParameters($parameters); $grid->addRowAction($rowAction); }