cdi/cdidatagrid

Zend Framework 2 Module that provides a datagrid

3.2.7 2017-01-30 20:14 UTC

This package is auto-updated.

Last update: 2024-03-29 03:20:29 UTC


README

Zend Framework 2 module.

It allows you to render a datagrid from an Doctrine2 entity.

Features: Paginate, Filter, Order, Add, edit, view and delete records

Modulo para Zend Framework 2.

Permite renderizar un datagrid a partir de una entidad de Doctrine 2.

Caracteristicas: Paginar,Filtrar, Ordenar, Agregar, editar, visualizar y eliminar registros

##Ejemplo/Example:

alt tag

Simple usage

$grid = $this->getServiceLocator()->get('cdiGrid');
$source = new \CdiDataGrid\DataGrid\Source\Doctrine($this->getEntityManager(), 'CdiCrm\Entity\Ticket');
$grid->setSource($source);
$grid->setRecordsPerPage(5);
$grid->prepare();
$view = new ViewModel(array('grid' => $grid));
return $view;

In View

<?php echo $this->CdiGrid($this->grid); ?>

Obs

-The default template need jQuery and Bootstrap

Functions

After "$grid->prepare();"

Hidden Column

$grid->hiddenColumn('columnName');

Change Column Visual Name

$grid->changeColumnName('columnName','newColumnName');

Set DateTime Column Format

$grid->datetimeColumn('createdAt', 'Y-m-d H:i:s');

Set render a column with a custom view helper

$grid->customHelperColumn('columnname',"ViewHelperName");

Set Template to Render

$grid->setTemplate("ajax");

Set a custom class to table

$grid->setTableClass("customClass table-condensed table-striped");

Set a custom class to Column (td)

$grid->classTdColumn('columnName', "customClass text-center col-md-1");

many more...