Ukázkové použití
protected function createComponentGrinder($name) { $db = $this->getService('database'); $entityName = 'Kdyby\Application\Presentation\Sitemap'; $model = new Kdyby\Components\Grinder\Models\NetteModel($db->table('users')->select("users.*, CustomerName as CName")->where("customers.CustomerID = users.CustomerID OR (customers.CustomerID IS NULL)")); //$model = new Kdyby\Components\Grinder\Models\NetteModel($db->table('users')); $model->setPrimaryKey("UserID"); $grid = new Kdyby\Components\Grinder\Grid($model); $grid->setUpProtection($this->getSession()); $grid->setRenderer(new Kdyby\Components\Grinder\Renderers\TableRenderer); // $grid->addCheckColumn('select'); $grid->addColumn('UserName', 'Jméno'); $grid->addColumn('UserLogin', 'Přihlašovací jméno'); $grid->addColumn('UserRole', 'Role')->addFilter(function ($role) { return Users::$Roles[$role]; }); $grid->addColumn('CName', 'Zákazník')->addFilter(function ($value) { return $value != null ? $value : "--"; }); // $column = $grid->addActionsColumn('detail', NULL, array( // 'caption' => 'Detaily', // 'handler' => callback($this, 'DetailsClicked') // )); // $column->addAction(new LinkAction, 'other') // ->setCaption('Jiné') // ->setHandler(callback($this, 'JineClicked')); // $grid->addColumn('destination', 'Cíl'); $grid->addAction('edit', 'Upravit') ->setLink($this->lazyLink('edit'), array('id' => 'UserID')); // přidá akci na konec gridu $grid->addAction('delete', 'Smazat') ->setLink($this->lazyLink('nonajaxForm:confirmDelete!'), array('id' => 'UserID','name' => 'UserName')); // $grid->addAction('delete', 'Smazat', array( // 'handler' => callback($this, 'DeleteClicked') // )); // přidá akci na konec gridu // $grid->addToolbarAction('send', 'Vypsat') // ->onSubmit[] = callback($this, 'VypsatSubmitted'); return $grid; }