Removing title from export buttons

Removing title from export buttons

harshithgharshithg Posts: 3Questions: 2Answers: 0

I am using the following datatables example for the purpose of export button. However, i am unable to remove title from the excel export by changing title:''. The code is as follows:

    <script type="text/javascript">

        $(document).ready(function () {
            $('#table_id tfoot th').each(function () {
              var title = $(this).text();
              $(this).html('<input type="text" placeholder="' +  + '" />');
            });

            var table = $('#table_id').DataTable({
                responsive: true,
                stateSave: true,
                "deferRender": true,
                "paging": true,
                "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
                stripeClasses: false,
                "pageLength": 50,
                dom: 'Blfrtip',
                buttons: [
                    {
                        extend: 'collection',
                        text: 'Export',
                        buttons: [
                            'copy',
                            'excel',
                            'csv',
                            'pdf',
                            'print',
                        ],
                       title: ' ',
                    }
                ],

                columnDefs: [
                    {
                        targets: "_all",
                        className: 'dt-center'
                    }
                ]
            });

            table.columns().every(function () {
                var that = this;

                $('input', this.footer()).on('keyup change', function () {
                    if (that.search() !== this.value) {
                        that
                            .search(this.value)
                            .draw();
                    }
                });
            });
            $('#table_id').show();
        });
    </script>

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586
    Answer ✓

    Hi @harshithg ,

    The title property is part of the excel button, not the collection, so you would declare it like this:

                        buttons: [
                            'copy',
                            {extend: 'excel', title: ''},
                            'csv',
                            'pdf',
                            'print',
                        ],
    

    Cheers,

    Colin

This discussion has been closed.