DataTables 1.9.4 + DataTables Plug-ins
// composer.json
{
"require": {
// ...
"pinano/datatables-bundle": "dev-master"
}
}
// composer.json
{
"require": {
// ...
"pinano/datatables-bundle": "1.9.4.1"
}
}
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Pinano\DataTablesBundle\PinanoDataTablesBundle(),
// ...
);
}
$ php composer.phar update pinano/datatables-bundle
Given your server's public directory is named "web", install the public vendor resources
$ php app/console assets:install web
Optionally, use the --symlink attribute to create links rather than copies of the resources
$ php app/console assets:install --symlink web
Once you have imported all the resources to the vendor folder, you can self-import the JS into your Symfony project as usual with:
{# block js #}
{% block javascripts %}
{% javascripts filter='cssrewrite' output='js/dataTables.js'
...
'@PinanoDataTablesBundle/Resources/public/js/jquery.dataTables.js'
'@PinanoDataTablesBundle/Resources/public/extras/TableTools/media/js/ZeroClipboard.js'
'@PinanoDataTablesBundle/Resources/public/extras/TableTools/media/js/TableTools.js'
...
%}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
{% endblock %}
And with the CSS as well using with:
{# block css #}
{% block stylesheets %}
{% stylesheets filter='cssrewrite' output='css/dataTables.css'
...
'bundles/pinanodatatables/css/jquery.dataTables.css'
...
%}
<link rel="stylesheet" type="text/css" media="screen" href="{{ asset_url }}" />
{% endstylesheets %}
{% endblock %}
Note: See kriswallsmith/assetic#53 for known limitations of assetic with CSS referencing.
I do not own DataTables files at all, I'm just providing a Bundle package to easy-install them all. Refer to the source code of the included files from DataTables for license information.