Format German numbers in inline editing
Format German numbers in inline editing
sven_oliver_simpson
Posts: 3Questions: 2Answers: 0
in Editor
Hi,
using $.fn.dataTable.render.number( '.', ',', 2, '€' ) the numbers are shown in German Format like €1.234,56.
By clicking on the number for inline editing it changes to the 1234.56
How can I change it to 1234,56 and process it correctly when sending to the server?
Regards
SOS
This discussion has been closed.
Answers
Hi Sven,
Editor is showing the data as it is given by the server to the browser. The
columns.render
function will manipulate that data into the display you see in the table, but Editor uses the "raw" data.So the best thing to do is probably to have the server perform the formatting and deformatting for you - you can do this with the
getFormatter
andsetFormatter
methods in the PHP libraries for Editor (assuming you are using the PHP libraries) - documentation here. You would use thegetFormatter
to replace the.
with,
and thesetFormatter
for vice versa.Regards,
Allan
As a follow up, I was just thinking that the best solution possible would be to use a number with English formatting as normal, but to use
<input type="number">
and the browser would do the localisation for you.You might be interested in this article on that topic.
You could try this approach in Editor using the following for your field:
Allan