copyHtml5 and newline
copyHtml5 and newline
trongart
Posts: 222Questions: 51Answers: 0
In the description for copyHtml5, it is possible to replace \n
in newline
with any other character which puts the copied text together instead of in separate lines. However, this works only when newline is not empty so that the character is between the copied results.
How can I remove newline separators alltogether so that the copied data is combined in one row with no line breaks? Setting newline: ''
does not work.
This question has an accepted answers - jump to answer
Answers
I think you are running afoul of this line and it's falsy evaluation. The expectation was that there would always be a character present for a new line replacement, even if it is just a space, since otherwise you would run the risk of running words together - e.g.
the\nnew
would becomethenew
.You'll also need to set the
stripNewlines
for theexportOptions
property to false since it is default enabled if you want custom control for new lines.stripNewlines
should mean that you get no new lines in an exported row. If that isn't happening for you, can you link to a test case showing the issue please?Allan
@allan Thank you so much for looking into this. Here is a test case for my issue: live.datatables.net/jerixice/1/edit
The goal is to click on the COPY button and to run all words together including the title and rows. I added
stripNewlines: false
, but it did not change anything.Instead of
TITLE
36
66
41
18
61
38
21
46
22
36
The copied text should be:
TITLE36664118613821462236
In your code "36" represents one row, and "66" another. That means that "stripNewlines" is pretty much irrelevant for you.
What you need is "customize":
http://live.datatables.net/tavatete/1/edit
This is exactly what I was looking for! Thank you!