i have used jquery code to export table data into excel file, got code from here
but providing custome file name is not working it is taking random filename.
how to provide custom file name from code.
<script>
$(function() {
$("button").click(function(){
$("#example").table2excel({
exclude: ".noExl",
name: "Employee"
});
});
});
</script>
1.Open jquery.table2excel.js
2.Find function getFileName(settings)
3.Change it to
function getFileName(settings) {
return ( settings.filename ? settings.filename : settings.name ) +
( settings.fileext ? settings.fileext : ".xls" );
}
settings.name is variable from your custom js scripts when u call jquery2excel In my example it looks like
$(".generateXLS").click(function(){
var idOfTable = $(this).attr("data-rel");
var tableName = $(this).attr("data-table-name");
$("#tableN"+idOfTable).table2excel({
name: tableName
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With