Sencha ExtJs Ext.field.Number Internationalization

cesarzeaExtJs, JavaScript Leave a Comment

About the Author

César Zea
Senior Software Engineer
SQL Server expert: 25 y.e.
Sencha ExtJS: 11 y.e.
Java J2EE: 10 y.e.
AWS API. AWS-DMS

Image

This Ext.field.Number override adds the property showThousandSeparator, whose default value is true, which is a flag indicating that this component should show the thousands separators in the number.

Also using the already existing properties decimals and  decimalSeparator allows to display and edit the numbers according to the following two international formats:

Europe format :      1.124.543,00
American Format : 1,124,543.00

Regardless of the format chosen, the getValue() and setValue() methods will continue to accept and return values in the standard format that uses the period as a decimal point.

You can check it in the following demo:

Image

Of course, if it suits you better it is easily transformable in the definition of a new component, which you can use in the same way, without overwriting Ext.Field.Num.

That is the GitHub repo. Any collaboration for its improvement, information about bugs, questions and suggestions are welcome, both through GitHub and directly to my email or through this page.

https://github.com/cesarzea/internationalNumberField

5 1 vote
Article Rating
Subscribe
Notify of
guest

0 Comments & Questions
Inline Feedbacks
View all comments