datatheke / pager-bundle
Pager & DataGrid bundle for Symfony
Installs: 2 737
Dependents: 0
Suggesters: 0
Security: 0
Stars: 11
Watchers: 3
Forks: 3
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.3
- symfony/config: ~2.3|~3.0
- symfony/console: ~2.3|~3.0
- symfony/dependency-injection: ~2.3|~3.0
- symfony/form: ~2.3|~3.0
- symfony/framework-bundle: ~2.3|~3.0
- symfony/http-foundation: ~2.3|~3.0
- symfony/http-kernel: ~2.3|~3.0
- symfony/options-resolver: ~2.3|~3.0
- symfony/property-access: ~2.3|~3.0
- symfony/routing: ~2.3|~3.0
Requires (Dev)
- ext-pdo_sqlite: *
- doctrine/orm: ~2.3
- jms/serializer: ~0.16
- pagerfanta/pagerfanta: ~1.0
- phpunit/phpunit: ^4.0
Suggests
- doctrine/doctrine-bundle: To use ORMQueryBuilderAdapter and ORMEntityAdapter
- doctrine/mongodb-odm-bundle: To use MongoDBQueryBuilderAdapter and MongoDBDocumentAdapter
- doctrine/orm: To use ORMQueryBuilderAdapter and ORMEntityAdapter
- jms/serializer-bundle: To serialize Pager and DataGrid
README
ABOUT
Pager & DataGrid bundle for Symfony2
Main features are :
- HTTP or Console mode
- "Adapters" with the ability to sort and filter:
- Array
- Doctrine ORM QueryBuilder
- Doctrine MongoDB QueryBuilder
- "Handlers" for various javascript libraries
- jqGrid
- Flexigrid
- Dynatable
- DataTables
- jQuery Autocomplete
- Bootstrap Typeahead
- jQuery Bootgrid
- Themable:
- Bootstrap 2
- Bootstrap 3
- Foundation
LICENSE
MIT (see LICENSE file)
INSTALL
Install with composer
composer.phar require "datatheke/pager-bundle"
Update your app/AppKernel.php
<?php //... $bundles = array( //... new Datatheke\Bundle\PagerBundle\DatathekePagerBundle(), );
USAGE
More exemples in the documentation
Datagrid
PHP
<?php /** * @Template() */ public function datagridAction() { $datagrid = $this->get('datatheke.datagrid')->createHttpDataGrid('MyBundle:MyEntity'); $view = $datagrid->handleRequest($this->getRequest()); return array('datagrid' => $view); }
TWIG
{{ datagrid(datagrid) }} {# OR BETTER #} {% extends '::base.html.twig' %} {% block stylesheets %} {{ parent() }} {{ datagrid_stylesheets(datagrid) }} {% endblock %} {% block javascripts %} {{ parent() }} {{ datagrid_javascripts(datagrid) }} {% endblock %} {% block body %} <div class="container"> <h1>Test DataGrid</h1> {{ datagrid_content(datagrid) }} </div> {% endblock %}
Pager
PHP
<?php /** * @Template() */ public function pagerAction() { $pager = $this->get('datatheke.pager')->createHttpPager('MyBundle:MyEntity'); $view = $pager->handleRequest($this->getRequest()); return array('pager' => $view); }
TWIG
{% extends '::base.html.twig' %} {% import 'DatathekePagerBundle:Pager:bootstrap3.html.twig' as helper %} {% block stylesheets %} {{ parent() }} {{ helper.stylesheets() }} {% endblock %} {% block javascripts %} {{ parent() }} {{ helper.javascripts() }} {% endblock %} {% block body %} <div class="container"> <h1>Test pager</h1> <form action="{{ pager_form_path(pager) }}" method="post"> <div class="panel panel-default"> <div class="panel-heading"> {{ helper.toolbar(pager) }} </div> <table class="table table-striped table-bordered table-hover"> <thead> <tr> <th>{{ helper.orderBy(pager, 'firstname', 'Firstname') }}</th> <th>{{ helper.orderBy(pager, 'lastname', 'Lastname') }}</th> </tr> <tr> <th>{{ helper.filter(pager, 'firstname') }}</th> <th>{{ helper.filter(pager, 'lastname') }}</th> </tr> </thead> <tbody> {% for row in pager.items %} <tr> <td>{{ row.firstname }}</td> <td>{{ row.lastname }}</td> </tr> {% endfor %} </tbody> </table> </div> {{ helper.paginate(pager) }} </form> </div> {% endblock %}