PHP code example of cdi / cdidatagrid

1. Go to this page and download the library: Download cdi/cdidatagrid 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/ */

    

cdi / cdidatagrid example snippets


$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;

 echo $this->CdiGrid($this->grid); 

$grid->hiddenColumn('columnName');

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

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

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

$grid->setTemplate("ajax");

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

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