Editor removes commas from strings
Editor removes commas from strings
When these are made up of numbers, eg: 123,147 becomes 123147 in the db and in a datatable after create.
I do not have any method or js function that removes them in my code. Please advise if this is by design or am I missing something? Can't these commas be escaped by editor? I could add some checks in preSubmit and escape these and other char's but to have to do this for all the editor fields I have now in my project would be a pain.
This question has an accepted answers - jump to answer
Answers
I need to add the underlying table field has a string data type
Hi @dynasoft ,
If the field is numeric, it would be best to store it without the comma in the DB so you can perform numeric operations, such as sorting. If you need it, it would be best to define the field in Editor as a
string
, then the entire syntax will be preserved.Cheers,
Colin
Hi
Thanks. I followed whats on https://editor.datatables.net/reference/option/fields.type but get error 'Uncaught Error adding field - unknown field type string'. Kindly advise.
The field should be a string. It will hold comma separated values, some values can be numeric.
It looks like a bug I'm afraid. I've just managed to reproduce that here. I'll dig into it and post back here when done.
Allan
Thought so as this only occurs when the data with the commas is numeric
Commit here for the fix. I'm going to tag and release Editor 1.9.2 this Friday with that fix.
Allan