Kendo version 2015.2.805
IE10 or Chrome 44
I have a Grid with edit set to Popup, and a template for editing.
The template includes a NumericTextBox
I need to set a format that will show the number of decimals entered, but no more.
So for a value 1.23 it would show 1.23, or a value 1.2345678 would show 1.2345678. But I can't get it to work.
A format of #######0.00000000 is showing 1.23000000 and 1.2345678
A format of #######0.0####### was showing 1.23 and 1.23
A format of ########.######## is showing 1 and 1
A format of #.# is failing to display the page (which normally means a script error).
My code:
<
input
name
=
"currentExchangeRate"
data-role
=
"numerictextbox"
data-bind
=
"value:currentExchangeRate"
data-decimals
=
"8"
data-format
=
"{0:#######0.0#######}"
data-min
=
"0"
data-spinners
=
"false"
/>
5 Answers, 1 is accepted
Hello Simon,
Actually with the provided configuration code both values 1.23 and 1.2345678 are displayed correctly. Please refer to the http://dojo.telerik.com/eTIJU and let me know if I am missing something.
Regards,Boyan Dimitrov
Telerik

The issue occurs when using the numericTextBox within a Kendo Grid using a template for the popup editor.
If I don't use a template and let Kendo generate its own numericTextBox inputs then it works correctly (that is the work-around I am currently using, though it limits what I can include in the popup window).

I've tried setting up a snippet to illustrate my problem
http://dojo.telerik.com/ILAKu
As it stands, with format ##.##, all values display rounded to the nearest integer, which is wrong. The same occurs with (for example) ######0.##.
If I change the format to #0.##, or ######0.0# then the grid doesn't display at all
A format of ###0.0####### will display the grid, but clicking Edit doesn't open the popup.
Since the "#" is used by the template in order to evaluate/execute an expression, they should be escaped. Otherwise they will be seen as code block and eventually executed instead of using as format option for the numeric text box.
Please refer to Kendo UI Templates Overview article for more information about templates.
A solution for this case would be escaping the format option for the numeric text box as shown below:
<input name=
"Freight"
data-role=
"numerictextbox"
data-bind=
"value:Freight"
data-decimals=
"8"
data-format=
"{0:\\#\\#.\\#\\#}"
data-min=
"0"
data-spinners=
"false"
/>
Regards,
Boyan Dimitrov
Telerik
