In my database i have a numeric column with 3 decimal places. this column is null-capable. i use format:“1.111,000” formatting. if i enter a number in the control it works fine. but i can not enter a null (nothing / blank) in this control. If in the database is null - it will be displayed as ‘NaN’
what i do wrong?
Hello @ObiWanKenobi ,
If I understood you correctly, you could use a custom formatting here to extend the default logic (it uses the same as in example Number.parse/Number.format methods internally): Code Snippet .
We already can have an empty string as a value, however you could additionally convert other invalid values to "" to store and use in a component.
And when saving values, you could convert the empty strings back to NULL for your database.
Hello Mari,
Thank you very much. Ich have a second Problem with the nummeric inputs (see my another post). Try to type in your snippet the value 123456,999 (in first or last controll). id does not work. you must type 123.456,999 ! but nobody does that. Do you have a solution for that issue?
Thanx in advance
Hello @ObiWanKenobi ,
This is an expected behaviour as when a “123456,999” value is entered, the webix.Number.format() from the example receives a non-valid argument. The method expects to get a valid JS number as the first argument (a number with a decimal point as a separator). The strings of a “1234.56” kind are treated properly as well as they can be converted to the valid numbers in the method. On the other hand, the values of “1234,56” kind (with a separator except the dot) cannot be propertly handled and are cut off.
You’ll need to update the custom formatting logic a bit to overcome this: Code Snippet .
And you could create a custom component to reuse such format: Code Snippet .
Hello Mari,
Thank you for this solution, it works properly.
Have a nice day