dynamic sheetName?
dynamic sheetName?
Dalex73
Posts: 30Questions: 4Answers: 4
Hi @allan
Is there any way to set a dynamic name for the sheetName option? I have modified the buttons code to allow for a function in the same way as filename/title. Is this one way of solving it (as it works for me) or can/is it done in any other way?
"sheetName" : function( d ) {
return $('#dropdown option:selected').text().trim().substring(0,31);
},
The changes to buttons js file is,
var _sheetname = function (config) {
var sheetName = config.sheetName;
if (typeof sheetName === 'function') {
sheetName = sheetName().replace(/[\[\]\*\/\\\?\:]/g, '');
}
return sheetName;
};
Then I just added sheetName: 'Sheet1', above filename: '*', under DataTable.ext.buttons.excelHtml5 = {
This discussion has been closed.
Replies
You would need to use the
customize
callback of theexcelHtml5
button type and customize the sheet name as you need:Allan
Perfect, thanks!