In Sencha Touch 2, how does one format a number with commas with either 0 or 2 decimal places? I imagine that there’s a built in way to do this?
For example, I have 1234.567 and I need the number as 1,234 and 1,234.57.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can do it easily with JavaScript only :
Add commas to the number
Round to the nearest integer
Round to two decimals
Hope this helps