datatables buttons() is always null

datatables buttons() is always null

george_furtadogeorge_furtado Posts: 2Questions: 1Answers: 1

Hi,
I'm trying to use buttons to export datatables, but i'm getting function buttons null on code like "table.buttons().container()
.appendTo( $('.col-sm-6:eq(0)', table.table().container() ) );". I have no idea why that is happening. Can anyone help me? The complete code is:'

            self.GridHistorico = $("#tableHistoricoVariavel").dataTable({
                bJQueryUI: false,
                bFilter: true,
                "data": data,
                bPaginate: true,
                sPaginationType: "full_numbers",
                bLengthChange: false,
                searching: true,
                columns:
                [
                  { data: 'Data' },
                  { data: 'ValorConv' }
                ]
            });

            new $.fn.dataTable.Buttons(self.GridHistorico, {
                buttons: [
                    'copy', 'excel', 'pdf'
                ]
            });

            self.GridHistorico.buttons().container().appendTo($('.col-sm-6:eq(0)', self.GridHistorico.table().container()));'

Thank's!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,210Questions: 1Answers: 10,415 Site admin

    Please link to a test case showing the issue so we can attempt to offer some help in resolving the issue.

    Allan

  • george_furtadogeorge_furtado Posts: 2Questions: 1Answers: 1
    Answer ✓

    Hi Allan,
    Thank's for the response. I found the issue. It's occurs when the attribute of culture is using a json file, like this: ' // "url": "Content/scripts/plugin/dataTables/culture/pt_BR.json"'. So I remove this for while and is working.

This discussion has been closed.