PHP code example of zfstarter / zfs-grid
1. Go to this page and download the library: Download zfstarter/zfs-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/ */
zfstarter / zfs-grid example snippets
'service_manager' => array(
'invokables' => array(
'ZFS\Grid\View\Helper\Configurator' => 'ZFS\Grid\View\Helper\Configurator'
)
),
'listeners' => array(
'ZFS\Grid\View\Helper\Configurator'
)
$serviceLocator
->get('ViewHelperManager')
->setInvokableClass('gridRowValue', 'ZFS\Grid\View\Helper\GridRowValue');
$users = array(
array(
'id' => 1,
'login' => 'Vasia',
'email' => '[email protected] ',
'status' => '0',
),
array(
'id' => 2,
'login' => 'Fedia',
'email' => '[email protected] ',
'status' => '1',
)
);
$grid = new GridModel();
$grid->setRows($users);
$grid->setColumns(
array(
new ColumnModel(array(
'name' => 'id',
'fieldName' => 'id',
'title' => 'ID',
)),
new ColumnModel(array(
'name' => 'login',
'fieldName' => 'login',
'title' => 'Login',
)),
new ColumnModel(array(
'name' => 'email',
'fieldName' => 'email',
'title' => 'E-mail',
))
)
);
// представим, что находимся в контроллере
return new ViewModel(array('grid' => $grid));
echo $this->grid($grid);
$column = new ColumnModel();
$column->setName('name');
$column->setFieldName('name');
$column->setTitle('User name');
echo $this->grid($grid);
echo $this->grid()->openTag($grid);
application.config.php
function ($valueFromRowCell, $wholeRow, $currentColumn) {}
<th>..</th>
<th>..</th>