Variable decimals format

3 posts, 0 answers
  1. Clinton Smyth
    Clinton Smyth avatar
    65 posts
    Member since:
    Apr 2007

    Posted 12 Feb 2013 Link to this post

    Hi

    I have 2 questions:
    1. How can I allow a variable number of decimals?  The user needs to be able to enter values such as: 1.23   or   1.236654   or  56.  I need to disable/prevent any reformatting - it must just accept the number the user enters (of course still preventing non-numeric characters).
    2. Is there a way to dynamically update the number of decimals with javascript after the NumericTextBox has been defined?
    Thanks


    UPDATE: I figured out the first one by going to http://docs.kendoui.com/getting-started/framework/globalization/numberformatting.  The following did the trick:
    var numericTextBox = $(el).width(100).kendoNumericTextBox({
                            format: "#.############",
                            decimals: 10,
                            spinners: false
                        }).data("kendoNumericTextBox");

    As a refinement to question 1, I would like to enforce a minimum number of decimal places (say 3).  e.g. if the user enters: 3.4, it'll update it to 3.400, if the user enters 3.12345, then it should be left as is.  I expected the format "0.000#################" to do this.  It adds the zeros as required but it then goes on to round the number to 3 decimal places as well (as if I'd given the format "0.000").  This appears to be a bug?

  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 14 Feb 2013 Link to this post

    Hello Clinton,

     
    I confirm this behavior as a bug, which we will be addressed in the next internal build of Kendo UI.
    As a gratitude for you involvement I updated your Telerik points.

    Kind regards,
    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Clinton Smyth
    Clinton Smyth avatar
    65 posts
    Member since:
    Apr 2007

    Posted 19 Feb 2013 Link to this post

    Thanks - looking forward to the next release.
Back to Top