$(window).on('entity:view:list', function (e, data) {
    /*
     * Datatables
     * .......................
     */
    MapEntity.mainDatatable = JQDataTable.init($('#objects-list'), null /* no load at startup */, {
        // Hide pk column
        aoColumnDefs: [ { "bVisible": false, "aTargets": [ 0 ] } ],
        sDom: "tpf",
        aaData: [],
        iDeferLoading: 0,
        iDisplayLength: 15,  // TODO: this is VERY ANNOYING ! I want to fill height !
    });

    // Adjust vertically
    expandDatatableHeight(MapEntity.mainDatatable);
    $(window).resize(function (e) {
        expandDatatableHeight(MapEntity.mainDatatable);
    });


    // Show tooltips on left menu
    $('#entitylist a').tooltip({'placement': 'right'});

    // Trigger a call to the format url
    $('#list-download-toolbar button').on('click', function () {
        var can_export = $('#list-download-toolbar .btn-group.disabled').length === 0;
        var format = $(this).attr('name');

        var format_url = window.SETTINGS.urls.format_list.replace(new RegExp('modelname', 'g'), data.modelname);
        var url = format_url + '?' +
                  $('#mainfilter').serialize() + '&format=' + format;

        if (can_export)
            document.location = url;

        return false;
    });

    // Hardcore Datatables customizations
    $('li.next a').html($('li.next a').html().replace('Next', ''));
    $('li.prev a').html($('li.prev a').html().replace('Previous', ''));
    $('#objects-list_filter input').attr('placeHolder', tr("Search"));
    $('#objects-list_filter label').contents().filter(function() {return this.nodeType === 3;/*Node.TEXT_NODE*/}).remove();

});


$(window).on('entity:view:detail', function (e, data) {
    //
    // Throw event when record is hovered
    // (used in Leaflet.ObjectLayer and below)
    $('.hoverable').hoverIntent(
        function on() {
            var modelname = $(this).data('modelname');
            var pk = $(this).data('pk');
            $(window).trigger('entity:mouseover', {pk: pk, modelname: modelname});
        },
        function off() {
            var modelname = $(this).data('modelname');
            var pk = $(this).data('pk');
            $(window).trigger('entity:mouseout', {pk: pk, modelname: modelname});
        }
    );

    //
    // Highlight (e.g. table rows) when record is hovered
    $(window).on('entity:mouseover', function (e, data) {
        var modelname = data.modelname;
        var pk = data.pk;
        var $item = $("[data-modelname='" + modelname + "'][data-pk='" + pk + "']");
        $item.addClass('hover');
    });
    $(window).on('entity:mouseout', function (e, data) {
        var modelname = data.modelname;
        var pk = data.pk;
        var $item = $("[data-modelname='" + modelname + "'][data-pk='" + pk + "']");
        $item.removeClass('hover');
    });
});

@@ -458,16 +458,654 @@
 eight !%0A
+        // Enable cache%0A        fnServerData: function ( sUrl, aoData, fnCallback, oSettings ) %7B%0A%09%09%09oSettings.jqXHR = $.ajax( %7B%0A%09%09%09%09%22url%22:  sUrl,%0A%09%09%09%09%22data%22: aoData,%0A%09%09%09%09%22success%22: function (json) %7B%0A%09%09%09%09%09$(oSettings.oInstance).trigger('xhr', oSettings);%0A%09%09%09%09%09fnCallback( json );%0A%09%09%09%09%7D,%0A%09%09%09%09%22dataType%22: %22json%22,%0A%09%09%09%09%22cache%22: true,%0A%09%09%09%09%22type%22: oSettings.sServerMethod,%0A%09%09%09%09%22error%22: function (xhr, error, thrown) %7B%0A%09%09%09%09%09if ( error == %22parsererror%22 ) %7B%0A%09%09%09%09%09%09oSettings.oApi._fnLog( oSettings, 0, %22DataTables warning: JSON data from %22+%0A%09%09%09%09%09%09%09%22server could not be parsed. This is caused by a JSON formatting error.%22 );%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D%0A%09%09%09%7D );%0A%09%09%7D%0A
     %7D);%0A

Enable cache in datatables