Buttons are not working anymore

Buttons are not working anymore

briceRestofutebriceRestofute Posts: 1Questions: 1Answers: 0

Hello there !

I'm trying to update dynamically an already initialized datatable (with some export and print buttons, with a searchbar). These functionnalities are working perfectly at first.
However, I have to replace data from my table, thanks to a script included in an iframe.

So, I think that I had to create another draw of this datatable.

Here's the code:
`

        dataTableProd = $('#myTable');

        dataTableProd.DataTable({
            "destroy": true,
            "ordering": false,
            "paging": false,
            "language": {
              "url": "/orders/js/french.json"
            },
            "initComplete": function() {
                // Just made some worthless stuff
            },
            dom: "Bfrtip",
            buttons: [
              { extend: "excel", text: "Export Excel", className: "btnExportExcel" },
              { extend: "pdf", text: "Export PDF" },
              { extend: "print", text: "Imprimer", exportOptions: 
                {
                  columns: ':visible',
                    stripHtml: false
                }
              }
            ]
        });

        dataTableProd.DataTable().draw();

`

This new structure is displayed perfectly. I checked the searchbar update about new data included in my table and I find it.
But the last functionnalities that doesn't work are the updated buttons, which apparently lost some listeners from "dataTables.buttons.min.js" script, even if I put it in the iframe page.

Can I have an alternative to call actions despite this problem with a custom listener on theses buttons, or should I make this listener back to fix it ?

Thanks in advance for your reply.

Answers

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

    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.