DataTables Bundle

Symfony2/Doctrine extension for DataTables jQuery

This bundle adds DataTables ajax functionality to your Symfony2/Doctrine project.

The DataTables bundle provides this functionality by bridging the gap between the user interface's table and one of the following structures:

  • Doctrine Query Builder
  • Array of data
  • Doctrine Repsository
This functionality can be achieved in a couple of different styles:
  • Controller Based 0.1.0+ - use two actions in a controller to get data
  • Model Based 0.2.0+ - Specify columns and a source in a flexible manner
  • Repository Based 0.3.0+- specify a repository and a structure and DataTables does the rest
  • Annotation Based 0.4.0+ - similar to Doctrine Entities with annotations
  • Yml Based 0.4.0+ - Define the configuration of your table through a yml file
  • Xml Based 0.4.0+ - Define the configuration of your table through a xml file
Other Features:
  • DataTables Manager to manage tables similar to entities
  • Twig extension for easy view integration
  • Custom rendering with templating closures


Add the package brown298\datatables to your composer.json

    "require" : {
    "brown298/data-tables-bundle": "dev-master"

For more information about Composer, please visit


Add Brown298DataTablesBundle to your application kernel

// app/AppKernel.php
public function registerBundles()
    return array(
        // ...
        new Brown298\DataTablesBundle\Brown298DataTablesBundle(),
        // ...


As part of the composer requirements, both jQuery and DataTables are added to the vendor directory. You are welcome to use those files, or install your own. But both jQuery and DataTables are required to be added to your templates to use this bundle.

# config.yml

                - %kernel.root_dir%/../vendor/datatables/datatables/media/js/jquery.js
                - %kernel.root_dir%/../vendor/datatables/datatables/media/js/jquery.dataTables.js
{# Resources\views\base.html.twig #}

    {% javascripts '@data_tables' %}
        < script type="text/javascript" src="{{ asset_url }}">< /script>
    {% endjavascripts %}