Nextras\Datagrid\Datagrid::addCellsTemplate PHP Méthode

addCellsTemplate() public méthode

public addCellsTemplate ( string | Nette\Bridges\ApplicationLatte\Template $path )
$path string | Nette\Bridges\ApplicationLatte\Template
    public function addCellsTemplate($path)
    {
        if ($path instanceof Template) {
            $path = $path->getFile();
        }
        if (!file_exists($path)) {
            throw new \InvalidArgumentException("Template '{$path}' does not exist.");
        }
        $this->cellsTemplates[] = $path;
    }

Usage Example

 protected function createComponentDataGrid()
 {
     return new Multiplier(function ($month) {
         $grid = new Datagrid();
         $grid->addColumn('l_year', 'Rok');
         $grid->addColumn('l_month', 'Měsíc');
         $grid->addColumn('l_description', 'Popis');
         $grid->addColumn('worked_days', 'Dny');
         $grid->addColumn('total_worked_hours', 'Hodiny');
         $grid->setDataSourceCallback(function ($filter, $order) use($month) {
             return $this->listings[$month];
         });
         $grid->addCellsTemplate(__DIR__ . '/templates/grid/grid.latte');
         return $grid;
     });
 }