Adding Export Buttons Removed My Pagination Menu

Adding Export Buttons Removed My Pagination Menu

Ninja JoeNinja Joe Posts: 15Questions: 7Answers: 1

I used the following code to create my DataTable:

$( '#builders-datatable' ).DataTable( { scrollX: true, pageLength: 50, pagingType: 'full_numbers',
    drawCallback: function() {
        $( '.dataTables_paginate > .pagination' ).addClass( 'pagination-rounded' );
    }
} );

However, when I added export buttons with:

dom: 'Bfrtip', buttons: buttonSettings,

My pagination menu went away!

$( '#builders-datatable' ).DataTable( { scrollX: true, pageLength: 50, pagingType: 'full_numbers', dom: 'Bfrtip', buttons: buttonSettings,
    drawCallback: function() {
        $( '.dataTables_paginate > .pagination' ).addClass( 'pagination-rounded' );
    }
} );

How can I show both the export buttons AND the pagination menu?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,344Questions: 26Answers: 4,954
    Answer ✓

    Please see this FAQ.

    Kevin

  • Ninja JoeNinja Joe Posts: 15Questions: 7Answers: 1
    edited June 2022

    This worked a charm, thank you. I personally feel button examples should include the "l" to prevent this from happening, though. For reference, I ended up going with:

    dom: 'lBfrtip',
    
  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin

    You can add the pageLength into the buttons array to display a page length list of options, as mentioned in the FAQ - that is usually the easiest way. The list of buttons is entirely customisable, which is why it isn't in there by default.

    Allan

Sign In or Register to comment.