geniv/nette-table

Table component for Nette Framework

v1.0.6 2018-02-25 23:33 UTC

This package is auto-updated.

Last update: 2024-12-14 04:36:12 UTC


README

Installation

$ composer require geniv/nette-table

or

"geniv/nette-table": ">=1.0.0"

require:

"php": ">=5.6.0",
"nette/nette": ">=2.4.0",
"dibi/dibi": ">=3.0.0",
"geniv/nette-locale": ">=1.0.0"

Include in application

neon configure:

services:
    - Table(%tablePrefix%)

usage:

use Table;

protected function createComponentTable1(Table $table)
{
    $table->setTemplatePath(__DIR__ . '/templates/Byty/cenikTable.latte')
        ->setTableName(PriceList::TABLE_NAME)
        ->setTableName(PriceList::TABLE_NAME, 'tab')
        ->setColumns('designation, floor')
        ->setColumns(['designation', 'floor'])
        ->setColumnLocale(null)     //<-default value is null
        ->setColumnLocale('language_col')
        ->addJoin('table_join', 'alias', 'alias.id=tab.id')
        ->addLeftJoin('table_join', 'alias', ['alias.id' => 'tab.id'])
        ->addLeftJoin('table_has_locale', 'lo_alias', 'lo_alias.id=tab.id AND lo_alias.id_locale=' . $table->getIdLocale())
        ->addWhere('image=1')
        ->addWhere('image=3')
        ->addWhere(['image' => 3])
        ->addOrder('position')
        ->addOrder('position', 'desc');
        
        // $table->getList()
        
    $table->enableCache(true)
        ->setCacheDependencies([Nette\Caching\Cache::EXPIRE => '30 minutes']);

    return $table;
}

usage:

{control table1}

usage in template:

<div n:foreach="$list as $item">
    <h1>{$item['title']}</h1>
</div>

{if $iterations==0}
    0 položek
{/if}