Issue dealing with special characters when using export options

Issue dealing with special characters when using export options

manpatmanpat Posts: 4Questions: 1Answers: 0
edited October 2020 in Free community support

following is the case where an _excel download _won't work until all special characters like / $, apostrophe etc are removed.

http://live.datatables.net/liwupoba/1/edit

Debugger code (debug.datatables.net):

body: function (data, row, column, node) {
if ($(data).is("input"))
return $(data).val();
else if ($(data).is("select"))
return $(data).val();
else
return data;
}

Error messages shown:
spining wheel on the excel button forever until we refresh the page
Description of problem:
An export works just fine but if the data contains a special character I am not able to run my jquery commands to check if the cell has a input or select etc

There was a related discussion, waiting for resolution: https://datatables.net/forums/discussion/49448/export-options-does-not-support-the-special-characters

Replies

  • rf1234rf1234 Posts: 2,950Questions: 87Answers: 416
    edited October 2020

    Error messages shown:
    spining wheel on the excel button forever until we refresh the page

    Not just this, you got this as well if you look at the console:

  • manpatmanpat Posts: 4Questions: 1Answers: 0

    That's correct.

    Its the original query that DataTable isn't handling special characters, in this case $ is the culprit. It can be anything like / ' $ | etc and the exception halts the export process.
    Question is -> Do I need to write overriding logic in export options or there is an elegant solution I am not aware of?

  • kthorngrenkthorngren Posts: 21,173Questions: 26Answers: 4,923

    You are trying to use jQuery is() with the data of the column:

    You might be better off using the node parameter, for example: ($(node).is("input").

    If you still need help then please update the example to show more of your specific solution with the input elements.

    Kevin

This discussion has been closed.