NumericTextbox wrapper: prevent removing of trailing zeros when added by user

1 Answer 594 Views
NumericTextBox wrapper
Vincent
Top achievements
Rank 3
Iron
Iron
Iron
Vincent asked on 28 Oct 2021, 09:59 AM

When a user enters trailing zeros I want the Numeric Textbox to keep them.

 

Here's an example of what I mean:

https://stackblitz.com/edit/kb6qcu?file=src/main.vue

Enter 17.00001, it keeps the decimals correct

Enter 17.00000, it removes all trailing zeros

Is it possible to configure the NumericTextbox to keep trailing zeros when the user explicitly enters them?

1 Answer, 1 is accepted

Sort by
1
Petar
Telerik team
answered on 01 Nov 2021, 06:38 PM

Hi Vincent,

The Vue NumericTextBox Wrapper component doesn't support the option of keeping the zeros only when the user enters them. A possible solution for your scenario could be to use the component with the below format configuration:

  <kendo-numerictextbox
    v-model.number="number"
    :format="'0.00000'"
    :min="0"
    :decimals="5"
    :round="false"
    :spinners="true"
  >
  </kendo-numerictextbox>

The above will show zeros after the decimal point. If you edit these zeros, the entered value will be presented in the component. Here is a StackBlitz project demonstrating the usage of the above code. 

I hope the provided solution will help you achieve your scenario.

Regards,
Petar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
NumericTextBox wrapper
Asked by
Vincent
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Petar
Telerik team
Share this question
or