change the decimal seperator for field editing (.net)
change the decimal seperator for field editing (.net)
In our datatable setup numbers are formatted and displayed ok as intended:
123.456,78
...using below formatters:
.Field(new Field("contract.contract_vat_amount")
.Validator(Validation.Numeric("de-DE", null))
.GetFormatter(Format.FromDecimalChar('.'))
.SetFormatter(Format.FromDecimalChar(','))
Problem:
upon edit, in the editor form and when editing inline fields, the same number (incoming this way from db) is then shown as:
123456.78
Any easy way here to use a render function within the edit form, to change the seperator from "." to "," like:
editor = new $.fn.dataTable.Editor({
ajax: "/api/AdminXYZ",
table: "#xyzt",
fields: [
{ label: "net:", name: "contract_vat_amount", function (render **maybe here ** --???!
We only need to change the decimal seperator, thousands seperators not needed, if easy solution at hand, means no plugins to install etc...
Replies
fields.setFormatteris the option you want to format a value for Editor. You'll need a correspondingfields.getFormatterto change it back into the format the database is expecting as well.Allan
Thanks Allan!!
Simple solution, works fine, done...
PS:
"getFormatter": modify your input / data before sending it back to the server
"setFormatter": modify incoming data before display in editor form or inline edit upon click