Buttons export and appendTo many datatables

Buttons export and appendTo many datatables

redtyperredtyper Posts: 2Questions: 1Answers: 0
edited January 2019 in Free community support

I have 12 datatables:

    <table id = "TABLE_1" class = "table table-striped"> 
    <table id = "TABLE_2" class = "table table-striped">

I need to display datatables with export and visibility buttons.
This is the datatables-init.js file

    $(document).ready(function() {
        var table = $("table[id^='TABLE']").DataTable( {
    
            buttons: ['copy', 'excel', 'pdf', 'colvis']
        });
        table.buttons().container()
            .appendTo(table.DataTable()('.col-md-6:eq(0)'));
    } );

The buttons do not display, I know that this is a problem with the place where they are displayed. Can anyone help ?

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @redtyper ,

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.