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

Variable decimals format

2 Answers 153 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
Clinton Smyth
Top achievements
Rank 1
Clinton Smyth asked on 12 Feb 2013, 09:17 PM
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 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 14 Feb 2013, 05:16 PM
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!
0
Clinton Smyth
Top achievements
Rank 1
answered on 19 Feb 2013, 10:10 PM
Thanks - looking forward to the next release.
Tags
NumericTextBox
Asked by
Clinton Smyth
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Clinton Smyth
Top achievements
Rank 1
Share this question
or