Datatables buttons not working.

Datatables buttons not working.

timmy4alltimmy4all Posts: 4Questions: 2Answers: 0
edited February 2016 in Free community support
$('#openQuotesTable').DataTable({

        'oLanguage' : {
            'sSearch' : 'Search',
            'scrollX': true
        },

        dom: 'Bfrtip',

        buttons: [
            'pageLength'
        ],

        bAutoWidth:false

    });

This is how i initialize the datables. but i get error in console.

TypeError: api.init is not a function
dataTables.buttons..js (line 1598, col 6)

var opts = api.init().buttons || DataTable.defaults.buttons;

Answers

  • glendersonglenderson Posts: 231Questions: 11Answers: 29

    Are you attempting to add a button for pageLength? Normally I see the buttons are for things like copy, excel, pdf. The length selection features appear all by themselves if you add the "l" in the dom option and you can set the various length options from the length menu.

    https://datatables.net/reference/option/lengthMenu

    I also recommend moving up to dataTables 1.10.x. A number of your options are using the older values.

  • timmy4alltimmy4all Posts: 4Questions: 2Answers: 0

    @glenderson. Thanks for your reply. My datatables version is 1.10.4 . The buttons dont work at all, not just for pagelength but for other stuff as well. I am avoiding upgrade to 1.10.10 because i will have to change a lot of things , almost 30-40 datatables will be affected if I upgrade. do the buttons not work with 1.10.4?

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin

    My datatables version is 1.10.4

    There is the issue. Update to the current release is always the first step when looking into errors.

    Allan

This discussion has been closed.