Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81972

dynamic sheetName?

$
0
0

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 = {


Viewing all articles
Browse latest Browse all 81972

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>