Siddhartha
Top achievements
Rank 1
Siddhartha
asked on 26 Apr 2012, 05:39 PM
Hi all,
Problem reproduced at http://jsfiddle.net/nA95j/7/
It seems that specifying decimals="0" option in the HTML initialization of numeric text box does not work. The same option when given as a constructor option does work.
It is mentioned in the Release Notes for Kendo UI version 2012.1.322 that this is fixed (http://www.kendoui.com/web/whats-new/release-notes/q1-2012-version-2012-1-322.aspx) but I see it is happening in case of HTML based initialization for a numeric text box.
I am using MVVM binding so I cannot declare the numeric text box and its arguments separately. Any suggestions or workarounds?
Thanks.
Problem reproduced at http://jsfiddle.net/nA95j/7/
It seems that specifying decimals="0" option in the HTML initialization of numeric text box does not work. The same option when given as a constructor option does work.
It is mentioned in the Release Notes for Kendo UI version 2012.1.322 that this is fixed (http://www.kendoui.com/web/whats-new/release-notes/q1-2012-version-2012-1-322.aspx) but I see it is happening in case of HTML based initialization for a numeric text box.
I am using MVVM binding so I cannot declare the numeric text box and its arguments separately. Any suggestions or workarounds?
Thanks.
12 Answers, 1 is accepted
0
Ryan
Top achievements
Rank 1
answered on 26 Apr 2012, 06:46 PM
change the code to:
$("#currency").kendoNumericTextBox({
decimals: 0,
format: '#'
});
the format string will set the control's display output...configuring the incrementer is an art form, mixing the correct settings for decimals, format, and step value :(
$("#currency").kendoNumericTextBox({
decimals: 0,
format: '#'
});
the format string will set the control's display output...configuring the incrementer is an art form, mixing the correct settings for decimals, format, and step value :(
0
Siddhartha
Top achievements
Rank 1
answered on 26 Apr 2012, 09:31 PM
Thanks for the reply, Ryan, but like I said, I am initializing the numeric text box from HTML (bound to an MVVM), and I cannot use the javascript declaration style to specify the decimals and format parameters.
0
Hello Siddhartha,
Please review the updated fiddle to see the correct way to configure the textbox.
All the best,
Dimo
the Telerik team
Please review the updated fiddle to see the correct way to configure the textbox.
All the best,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Siddhartha
Top achievements
Rank 1
answered on 27 Apr 2012, 01:02 PM
Thanks Dimo! This works fine. Appreciate the time you guys give to answering the queries.
Did I miss something or is the documentation in need for an update on this issue?
Thanks,
Siddhartha
Did I miss something or is the documentation in need for an update on this issue?
Thanks,
Siddhartha
0
Hello Siddhartha,
Declarative widget initialization is shown at
http://demos.kendoui.com/web/mvvm/widgets.html
MVVM bindings work with data attributes, which start with data-, as shown at
http://www.kendoui.com/documentation/framework/mvvm/bindings/attr.aspx
This is because custom attributes that do not start with data- are not valid HTML markup. For example, decimals HTML attribute does not exist.
All the best,
Dimo
the Telerik team
Declarative widget initialization is shown at
http://demos.kendoui.com/web/mvvm/widgets.html
MVVM bindings work with data attributes, which start with data-, as shown at
http://www.kendoui.com/documentation/framework/mvvm/bindings/attr.aspx
This is because custom attributes that do not start with data- are not valid HTML markup. For example, decimals HTML attribute does not exist.
All the best,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Siddhartha
Top achievements
Rank 1
answered on 27 Apr 2012, 03:12 PM
Thanks, guessed about the HTML compliance of min max etc. after a little while.
About the error, I was actually referring to the line first line of example on http://www.kendoui.com/documentation/ui-widgets/numerictextbox/configuration.aspx
It talks about using "decimals" instead of "data-decimals" for HTML:
About the error, I was actually referring to the line first line of example on http://www.kendoui.com/documentation/ui-widgets/numerictextbox/configuration.aspx
It talks about using "decimals" instead of "data-decimals" for HTML:
// specify in the HTML
<input id="numeric" value="10" type="number" min="0" max="1" step=".1" decimals="1"/>
<br />
0
Siddhartha
Top achievements
Rank 1
answered on 27 Apr 2012, 03:12 PM
Thanks, guessed about the HTML compliance of min max etc. after a little while.
About the error, I was actually referring to the line first line of example on http://www.kendoui.com/documentation/ui-widgets/numerictextbox/configuration.aspx
It talks about using "decimals" instead of "data-decimals" for HTML:
About the error, I was actually referring to the line first line of example on http://www.kendoui.com/documentation/ui-widgets/numerictextbox/configuration.aspx
It talks about using "decimals" instead of "data-decimals" for HTML:
// specify in the HTML
<input id="numeric" value="10" type="number" min="0" max="1" step=".1" decimals="1"/>
<br />
0
This must be a copy-paste error, we'll fix that, sorry about the confusion.
Greetings,
Dimo
the Telerik team
Greetings,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Bill
Top achievements
Rank 1
answered on 13 Aug 2012, 08:09 PM
The declarative configuration shown in http://jsfiddle.net/dimodi/nA95j/10/ (data-decimals="0") does not work to suppress decimals for stationary display of a number. Rather it seems to affect the display when increasing or decreasing values. Curiously, data-format = "d" does suppress decimals in the display, as well as in the increase and decrease.
0
Hello Bill,
Decimals is related to the input textbox only. Format should be used to control the formatted value. Please refer to the updated example:
http://jsfiddle.net/dimodi/nA95j/85/
Greetings,
Dimo
the Telerik team
Decimals is related to the input textbox only. Format should be used to control the formatted value. Please refer to the updated example:
http://jsfiddle.net/dimodi/nA95j/85/
Greetings,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Alton
Top achievements
Rank 1
answered on 25 Sep 2014, 04:53 PM
@Dimo, didnt know if you noticed, but when I look at the JSFiddle it shows 2 decmials during display. If I click to edit, it looses the decimals, but they are always there unless I am editing.
0
Hello Alton,
- decimals is applicable when the widget is focused
- format is applicable when the widget is not focused
Regards,
Dimo
Telerik
- decimals is applicable when the widget is focused
- format is applicable when the widget is not focused
Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!