1. Go to this page and download the library: Download prezent/grid 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/ */
prezent / grid example snippets
namespace My\Grids;
use Prezent\Grid\BaseGridType;
use Prezent\Grid\Extension\Core\Type\DateTimeType;
use Prezent\Grid\Extension\Core\Type\StringType;
use Prezent\Grid\GridBuilder;
class MyGridType extends BaseGridType
{
public function buildGrid(GridBuilder $builder, array $options = [])
{
$builder
->addColumn('id', StringType::class, [
'label' => 'ID',
'url' => '/view/{id}',
])
->addColumn('name', StringType::class)
->addColumn('created', DateTimeType::class, ['pattern' => 'yyyy qqq'])
->addAction('edit', ['url' => '/edit/{id}'])
;
}
}
namespace My\Controllers;
use My\Grids\MyGridType;
class MyController
{
public function indexAction()
{
$data = $this->db->findSomeData();
$grid = $this->getService('grid_factory')->createGrid(MyGridType::class);
$this->view->data = $data;
$this->view->grid = $grid->createView();
}
}
bash
$ php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.