We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

The example (Maintain trailing zeros in NumericTextBox) in the documentation doesn't work

Hi!

The example give on this page:

https://ej2.syncfusion.com/angular/documentation/numerictextbox/how-to#maintain-trailing-zeros-in-numerictextbox

breaks the NumericTextbox. While it does show the trailing zeros when focused, clicking on the spinners will then show NaN in the textbox....



3 Replies

CI Christopher Issac Sunder K Syncfusion Team December 4, 2018 06:37 PM UTC

Hi Paul, 
 
Thank you for contacting Syncfusion support. 
 
We have checked your reported problem at our end. We were unable to reproduce the reported problem in the mentioned documentation sample. But we were able to reproduce that problem with globalization support for NumericTextBox and our mentioned documentation code block. The reported problem occurs due to improperly formatted the NumericTextBox component value(without consider the globalization support) and set to NumericTextBox. You can resolve this problem by using below code block for both focus and change event of NumericTextBox, 
 
   //create the instance for NumericTextBox 
let element: any = document.getElementById('numeric'); 
let numericObj: any = element.ej2_instances[0]; 
//Initialize the Internalization 
let intl: any = new Internationalization(numericObj.locale); 
//Formatting the value 
let formattedValue: string = intl.getNumberFormat({ 
    skeleton: numericObj.format, maximumFractionDigits: numericObj.decimals, 
    minimumFractionDigits: numericObj.decimals, useGrouping: false 
})(numericObj.value) 
//Set the value to NumericTextBox 
numericObj.element.value = formattedValue; 
 
We will resolve this problem in our documentation on as soon as possible.  
 
Please let us know, if you have any concerns on this. 
 
Thanks, 
Christo 



PK Paul Kocher December 5, 2018 08:43 AM UTC

Hello Christo,

thanks for your response. The code you gave me works fine.


CI Christopher Issac Sunder K Syncfusion Team December 5, 2018 12:18 PM UTC

Hi Paul, 

We are glad to hear that the provided code snippet resolved your issue. Please get back to us if you require any further assistance. 

Thanks, 
Christo

Loader.
Live Chat Icon For mobile
Up arrow icon