This is a migrated thread and some comments may be shown as answers.

Setting displayable decimal places using data-attribute initialization

3 Answers 643 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 28 Jun 2013, 07:42 PM
If I understand numerictextbox correctly, the decimals property allows me to set how many decimal places are shown; if I understand data-attribute initialization correctly, I can set the decimals property use data-decimals="num"

I have the following numerictextbox:

               <input data-role="numerictextbox" value="15.284123" data-decimals="6" data-step="0.01"/>

I only see the value "15.28" displayed.  How can I get all 6 decimal places to be displayed
http://jsfiddle.net/raltman/W48Em/5/

Thanks.

3 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 01 Jul 2013, 10:49 AM
Hello Robert,

 
The decimals option controls the NumericTextBox value precision. In other words, if the decimals is set to 6, the widget will persist the value fraction up to the sixth digit. In order to change number formatting you will need to define the format of the widget:

<input data-role="numerictextbox"
        value="15.284123"
        data-decimals="6"
        data-step="0.01"
        data-format="n6"
    />
For more information about numeric formats check this help topic.

Regards,
Georgi Krustev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Dejan
Top achievements
Rank 1
answered on 23 Oct 2017, 09:15 AM
Hello, i see this is old post but i have same problem, just i use this advise and its ok. My problem is that if i enter 15.2841 and need 9 decimals then rest is field with zeros so in post i have 15.28410000 and i want to send number as it is with maximum decimals of 9 but minimum of 2. Thank you.
0
Stefan
Telerik team
answered on 25 Oct 2017, 07:29 AM
Hello, Dejan,

Currently, the NumericTextBox will send the value based on the set decimals.

I can suggest to programmatically format the value before post or on the server once it is received.

Also, I can suggest submitting a feature request for an option which will automatically remove the all of the zeros at the end. Then based on its popularity we may implement it in a future release:

http://kendoui-feedback.telerik.com/forums/127393-kendo-ui-feedback/category/170304-numerictextbox

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
NumericTextBox
Asked by
Robert
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Dejan
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or