4

I need to 1/10 and 1/100 part of percent, but kendo ui numeric text box allows enter a whole percent. I try to do something like thins:

$("#percent").kendoNumericTextBox({
  format: "##.0000 %"
});

but it doesn't work.

Any ideas?

1 Answers1

6

Depending on how you want to manage the value assigned there are two possible solutions.

Case 1: If you want that value 12.3456 gets displayed as 12.3456%, you should do:

$("#percent").kendoNumericTextBox({
    format: "##.0000 \\%",
    decimals: 4,
    value: 12.3456
});

Case 2: If you want that value 12.3456 gets displayed as 1234.5600%, you should do:

$("#percent").kendoNumericTextBox({
    format: "p4",
    decimals: 4,
    value: 12.3456
});

Case 3: If you want that value 12.3456 gets displayed as 1234.56%, you should do:

$("#percent").kendoNumericTextBox({
    format: "p2",
    decimals: 4,
    value: 12.3456
});

See it in action here: http://jsfiddle.net/OnaBai/4ab9Z/

OnaBai
  • 40,767
  • 6
  • 96
  • 125
  • 1
    Im using angular-kendo and for me case 1 gives me 1234.56%, how would one go about eliminating the * 100 so that the contents of the numeric text box is representative of the percentage displayed? – hally9k Jun 15 '15 at 21:36
  • k-format="\'# \\\\%\'" the double double escape caught me out... ;) – hally9k Jun 15 '15 at 21:41