DataTables / TableTools

Please note that TableTools has now been retired and replaced by the Buttons and Select extensions which offers significant improvements and API integration with the rest of DataTables and the other extensions.
http://datatables.net/
Other
237 stars 149 forks source link

Header title created with headerCallback are not exported #74

Open xibman opened 9 years ago

xibman commented 9 years ago

If you use the header callback to insert column title, it isn't use on csv,excel and pdf export.

just change this line in _fnGetDataTablesData:

sLoopData = dt.aoColumns[i].sTitle.replace(/\n/g," ").replace( /<.*?>/g, "" ).replace(/^\s+|\s+$/g,"");
sLoopData = this._fnHtmlDecode( sLoopData );

by

sLoopData = dt.aoColumns[i].sTitle !='' ? dt.aoColumns[i].sTitle : dt.aoColumns[i].nTh.innerText;
sLoopData = sLoopData.replace(/\n/g," ").replace( /<.*?>/g, "" ).replace(/^\s+|\s+$/g,"");
sLoopData = this._fnHtmlDecode( sLoopData );