Integration with other tools

Django Pipeline

If you want to compress Django ezTables with Django Pipeline, you should change the way you load it.

First add jQuery, Django.js and jQuery Datatables (and optionnaly bootstrap support) to your pipelines in your settings.py:

PIPELINE_JS = {
    'base': {
        'source_filenames': (
            '...',
            'js/libs/jquery-2.0.0.js',
            'js/djangojs/django.js',
            'js/libs/datatables/jquery.dataTables.js',
            'js/libs/datatables/datatables.bootstrap.js',
            '...',
        ),
        'output_filename': 'js/base.min.js',
    },
}

Add Datatables Bootstrap CSS to your CSS pipeline:

PIPELINE_CSS = {
    'base': {
        'source_filenames': (
            '...',
            'css/datatables.bootstrap.css',
            '...',
        ),
        'output_filename': 'js/base.min.css',
    },
}

Instead of using the django_js template tag:

{% load js %}
{% django_js %}

you should use the django_js_init and include your compressed bundle:

{% load js compressed %}
{% django_js_init %}
{% compressed_js "base" %}

RequireJS

Django ezTables works with RequireJS but it requires some extras step to do it.

Preloading prerequisites

You should use the django_js_init template tag before loading your application with RequireJS.

{% load js %}
{% django_js_init %}
<script data-main="scripts/main" src="scripts/require.js"></script>

It works with django-require too:

{% load js require %}
{% django_js_init %}
{% require_module 'main' %}

path and shim configuration

You should add extras paths and shim configurations for Django.js and Datatables:

require.config({
    paths: {
        'jquery': 'libs/jquery-2.0.0',
        'django': 'djangojs/django',
        'datatables': 'libs/datatables/js/jquery.dataTables.min',
        'datatables.bootstrap': 'libs/datatables/js/datatables.bootstrap'
    },

    shim: {
        'bootstrap': {
            deps: ['jquery'],
            exports: '$.fn.popover'
        },
        'django': {
            "deps": ["jquery"],
            "exports": "Django"
        },
        'datatables': {
            deps: ["jquery"],
            "exports": "$.fn.dataTable"
        },
        'datatables.bootstrap': {
            deps: ["datatables"]
        }
    }
});

Paths are relative to {{STATIC_URL}}/js. Adapt it to your configuration.