1. Go to this page and download the library: Download uestla/twigrid library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
uestla / twigrid example snippets
// app/Grids/UsersGrid.php
final class UsersGrid extends TwiGrid\DataGrid
{
private $database;
public function __construct(Nette\Database\Explorer $database)
{
parent::__construct();
$this->database = $database;
}
protected function build(): void
{
// TODO
}
}
// app/Grids/UsersGrid.php
final class UsersGrid extends TwiGrid\DataGrid
{
// ...
protected function build(): void
{
$this->addColumn('firstname', 'Firstname');
$this->addColumn('surname', 'Surname');
$this->addColumn('streetaddress', 'Street address');
$this->addColumn('city', 'City');
$this->addColumn('country_code', 'Country');
}
}