DataTable Jquery load Tools after ajax

1

I have a jQuery datatable that has the toolbar with .swf. When loading the page initially, the toolbar is displayed correctly, but I need to load the datatable when clicking on a link, where it is filled, but the toolbar does not appear.

The datatable is in the datafile.php file, called by include in the file data.php .

I'm calling the tools for this code:

$(document).ready( function () {
    var table = $('#data_table_button').dataTable();
    var tableTools = new $.fn.dataTable.TableTools( table, {
       "Buttons": [
            "copy",
            "csv",
            "xls",
            {
                "sExtends": "pdf",
                "sPdfOrientation": "landscape",
                "sPdfMessage": "Your custom message would go here."
            },
            "print"
        ]

    });

    $(tableTools.fnContainer() ).insertAfter('div.clear');
});

The function onclick , to load the data is:

function lista_contas(id) {
    var url = 'dados_tabela.php';
    var method = 'POST';
    var params = 'id='+id;
    params += '&select_ano='+document.getElementById('select_ano').value;
    var container_id = 'list_container' ;
    var loading_text = '<img src="img/load.gif">' ;
    // call ajax function
    ajax (url, method, params, container_id, loading_text) ;

    $(document).ajaxComplete(scripts);
}
    
asked by anonymous 19.06.2015 / 22:05

0 answers