Sencha ExtJs Ext.field.Number Internationalization

cesarzeaExtJs, JavaScript Leave a Comment

About the Author

César Pedro Zea Gómez
A Fractional CTO who helps enterprises turn data chaos into profitable growth. With 34 years of experience bridging board-level strategy and hands-on technical execution, he delivers battle-tested solutions, not theory.

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
Oldest
Newest Most Voted
Inline Feedbacks
View all comments