Setting displayable decimal places using data-attribute initialization

4 posts, 0 answers
  1. Robert
    Robert avatar
    39 posts
    Member since:
    Oct 2012

    Posted 28 Jun 2013 Link to this post

    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.
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3725 posts

    Posted 01 Jul 2013 Link to this post

    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!
  3. Dejan
    Dejan avatar
    1 posts
    Member since:
    Mar 2017

    Posted 23 Oct in reply to Georgi Krustev Link to this post

    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.
  4. Stefan
    Admin
    Stefan avatar
    1269 posts

    Posted 25 Oct Link to this post

    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.
Back to Top