Grido\Grid::getTablePrototype PHP Method

getTablePrototype() public method

Returns table html element of grid.
public getTablePrototype ( ) : Nette\Utils\Html
return Nette\Utils\Html
    public function getTablePrototype()
    {
        if ($this->tablePrototype === NULL) {
            $this->tablePrototype = \Nette\Utils\Html::el('table');
            $this->tablePrototype->id($this->getName());
        }
        return $this->tablePrototype;
    }

Usage Example

Beispiel #1
0
 /**
  * Create grid UI component Grido\Grid
  *
  * @param array|IRepository|Selection $data
  * @param string                      $primaryKey
  * @param integer                     $perPage
  * @param array                       $permanentlyFilter
  *
  * @return Grid
  */
 public function createGrido($data = null, $primaryKey = null, $perPage = null, $permanentlyFilter = [])
 {
     $grid = new Grid();
     // set data model
     if ($data) {
         if ($data instanceof IRepository) {
             $dataModel = new Mepatek\Components\Grido\DataSources\RepositorySource($data);
             $dataModel->setPermanentlyFilter($permanentlyFilter);
         } elseif ($data instanceof Selection) {
             $dataModel = new Grido\DataSources\NetteDatabase($data);
         } else {
             $dataModel = new Grido\DataSources\ArraySource($data);
         }
         $grid->setModel($dataModel);
     } else {
         $dataModel = new Grido\DataSources\ArraySource([]);
         $grid->setModel($dataModel);
     }
     // set primary key
     if ($primaryKey) {
         $grid->setPrimaryKey($primaryKey);
     }
     // set properties of grido
     $grid->filterRenderType = \Grido\Components\Filters\Filter::RENDER_INNER;
     if ($this->translator) {
         $grid->setTranslator($this->translator);
     }
     $grid->getTablePrototype()->class("table table-striped table-hover table-bordered dataTable");
     // set item per page
     if ($perPage) {
         $grid->setDefaultPerPage($perPage);
     }
     return $grid;
 }