Datatable Jquery load Tools after ajax

Asked

Viewed 347 times

1

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

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

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);
}
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.