1. Go to this page and download the library: Download emc/table-bundle 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/ */
php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new EMC\TableBundle\EMCTableBundle(),
);
}
php
namespace Acme\MyBundle\Table\Column;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class CustomType extends ColumnType {
public function buildView(array &$view, ColumnInterface $column, array $data, array $options) {
parent::buildView($view, $column, $data, $options);
/* Add you column data view here. You can access to them in the twig extension widget */
}
public function setDefaultOptions(OptionsResolverInterface $resolver) {
parent::setDefaultOptions($resolver);
/* define you parameters here */
}
public function getName() {
return 'custom';
}
}
php
/* Controller */
...
$table = $factory->create(new MyTableType(), null, array(
...
'caption' => 'My sub table example',
'subtable' => new MySubTableType(),
'subtable_params' => array('cityId' => 'c.id'),
'subtable_options' => array( /* can take the same options as the root table */ )
...
);
php
use Symfony\Component\HttpFoundation\Request;
use Acme\MyBundle\Table\Type\MyTableType
public function indexAction(Request $request) {
/* @var $factory \EMC\TableBundle\Table\TableFactory */
$factory = $this->get('table.factory');
$table = $factory ->create(
new MyTableType(),
null,
array('caption' => 'My table example')
)
->getTable();
return $this->render('AcmeMyBundle:Table:index.html.twig', array('table' => $table));
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.