BUG: Keytable Functionality
BUG: Keytable Functionality

Link to test case: https://editor.datatables.net/examples/extensions/excel.html
Debugger code (debug.datatables.net):
Error messages shown: Input not valid
Description of problem:
I'm looking at the salary column and trying to copy and paste and it attempts to copy the data that was RENDERED rather than the underlying data so therefore, you get an improper format error ("input not valid"). How do you use copy+paste keytable functionality on columns that have a special rendering?
Answers
You'd need to have a deformatter to convert the formatted value into a plain numeric one. e.g. in this case you could simply strip out the
$
and,
(assuming US number style input).Allan
Allan,
Thanks for the heads up. Do you think a deformatter is something we can add to the documentation?
So would you say the best way is to use the deformatter when I'm doing CTRL+C so that the right number is stored on my clipboard?
I'm only seeing this issue when I copy+paste. Do you foresee any other instance I should accommodate for to make sure I don't have this issue?
I have a render property for my number fields. Is there a reverse render method? I'd rather do something like that than to strip the commas because there will be instances when I will be doing things in US dollars or EUROs, and commas/periods are often switched.
Available here: https://editor.datatables.net/manual/php/formatters . Use a set formatter in this case. That will then allow the user to submit things such as
$1,000
as well. You'll probably need to update the validation you are using for the field to allow for that type of input as well.The other option is to use
preSubmit
to modify the data before it is sent to the server.No - because you wouldn't be able to control that if someone selected the data from a different web-page, or another app - e.g. Excel. You need to do it once pasted on (or possibly on paste).
Not that I can think of.
No sorry. You could just remove all non-numeric characters, but you need to be cause about negatives, comma decimals, etc.
Allan