Export button breaks for NULL-data in a cell
Export button breaks for NULL-data in a cell
![Inso2008](https://secure.gravatar.com/avatar/de804aec1d5c9a54a8b878a9f8edda3a/?default=https%3A%2F%2Fvanillicon.com%2Fde804aec1d5c9a54a8b878a9f8edda3a_200.png&rating=g&size=120)
Hello, I'm seeing a possible regression in Buttons version 3.2.1.
The affected function is export buttons (tested with excelHtml5
).
The problem is that a cell with its data == NULL
shows correctly in browser (empty), but breaks the export.
Conditions for reproduction:
* Data with NULL
in some column; this column does not define defaultContent
nor render
function.
* The export button does not redefine (uses the default) config.exportOptions.format.body
(and .header
and .footer
)
The nature of the problem:
* Buttons v. 3.2.1 introduces smarter parsing of data: the function Buttons.stripData
has new logic for handling data that is an instance of Node
.
* The condition that checks for Node
evaluates the expression (typeof str === 'object' && str.nodeName && str.nodeType)
* When NULL
is passed, its typeof
is 'object'
, but the further tests fail on (NULL).nodeName
.
What to do?:
* Maybe NULL-data in a table isn't nice, but it did work with earlier versions of export buttons, and does work in display, and so arguably it should still work now.
* Expanding the Node-testing expression to (typeof str === 'object' && str && str.nodeName && str.nodeType)
should restore the earlier behaviour for NULL-data (return NULL
).
Answers
I committed this change last week which should fix it.
Are you able to try the nightly and see if that fixes it for you?
Allan
Great! That is the fix. Thank you.
Awesome - I'll get it packaged up and released shortly.
Allan