Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set export filename in datatable

Hi everyone I want to set the export file name to my datatable how do i do so using jquery datatable , can someone please help me out with this , thanks

like image 406
Kavya Vishwanath B Avatar asked Dec 19 '22 13:12

Kavya Vishwanath B


2 Answers

$(document).ready(function() {
    $('#example').DataTable( {
    	dom: 'Bfrtip',
        buttons: [
            {
                extend: 'excelHtml5',
                title: 'Data export'
            },
            {
                extend: 'pdfHtml5',
                title: 'Data export'
            }
        ]
    } );
} );
like image 92
Chandra Avatar answered Jan 08 '23 15:01

Chandra


I just come to know that by default it takes page-title as export file-name. So I hack it and change the tilte of the page using Jquery.

$('title').html("Your custom filename");
like image 24
Hassan Siddique Avatar answered Jan 08 '23 15:01

Hassan Siddique