Home > Blockchain >  Datatable Show entries box vs export buttons
Datatable Show entries box vs export buttons

Time:07-03

My issue is strange, when i try to put excel export button in datatable then Show entries button will be removed. see below screen shot

added excel button

without excel button

enter image description here

I want both show entries and excel button

Below is my code:

var master = $('#master_table').dataTable({

                order: [[ 0, "desc" ]],
                language:{
                    url: '{{ url('en.json') }}'
                },
                columnDefs: [ {
                orderable: false,
                targets:   [0,1,,2],
                } ],
                select: {
                    style:    'os',
                    selector: 'td:first-child'
                },
                sPaginationType: "full_numbers",
                dom: 'Bfrtip',
                buttons: [
                    'excel'
                ]

        });

CodePudding user response:

Try adding lBfrtip to dom property

$(document).ready(function() {
    $('#example').DataTable( {
        dom: 'lBfrtip',
        buttons: [
            'copy', 'csv', 'excel', 'pdf', 'print'
        ]
    } );
} );

Reference --> https://datatables.net/reference/option/dom

  • Related