jQueryUI theme HTML not removed from headers when exporting.

jQueryUI theme HTML not removed from headers when exporting.

CrimblepudCrimblepud Posts: 3Questions: 1Answers: 0
edited August 2015 in Free community support

Using DataTables 1.10.8 and Buttons 1.0.1
I am also using the jQueryUI styling/theme by including all the correct files, etc..

I need to be able to export data with headers from a table with any HTML content using the "copy", "csv", "excel" and "pdf" tables, so I have set the "stripHtml" property to true for the "extendedOptions" object for each of these buttons.
When not using the jQueryUI theme, this works fine, but when I am using the jQueryUI theme, the headers contain extra HTML:

<div class="DataTables_sort_wrapper">
Name<span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-n"></span>
</div>

The above is the first part of the header (I had to write it as three lines here, but is normally all on single line), for the first column, as generated by a test case set up on JSFiddle, here: https://jsfiddle.net/Crimblepud/j5aLhq2v/11/

I need help as to how to "fix" this, and is this a bug?

Thanks in advance...

Answers

  • allanallan Posts: 63,210Questions: 1Answers: 10,415 Site admin

    Hmmm - interesting one. Yes it is a bug in that is it is unexpected output, but no it is not a bug because the stripHtml option is being set to false and therefore HTML is not being stripped...

    I'm not 100% sure how to address this at the moment to be honest. The next major version of DataTables is going to include an API to get and set the header text for a cell, which will address this, but at the moment, there is no way around this other than to modify the Buttons code and have it ignore stripHtml for the header.

    Allan

This discussion has been closed.