Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sencha extjs setValue string to numberfield

I need to use numberfield for user input number. When I set string '123,555' it shows only 123 to numberfield. But if I use textfield, it works as expected. I use this for thousand separation.

xtype: 'numberfield',
itemId: 'payment1',
cls : 'txtAlignRight',
flex : 4,
value:'0',
autoComplete: false,
autoCorrect: false,
clearIcon: false,
originalValue: true,
required: true,
maxLength: 15,

//------------------
num.setValue('123,555')
//result = 123

Is there any solutions to do it? Thanks in advance. Note: I use sencha extjs 6 modern.

like image 639
Phon Soyang Avatar asked Oct 29 '22 18:10

Phon Soyang


1 Answers

TO change which chars are allowed. You might wanna change these properties
The way these properties work is here

  1. autoStripChars: false,
  2. disableKeyFilter: true
  3. stripCharsRe: false
  4. maskRe: false

Sounds like you're needing to add Formatting to a number field.

here is an override that adds the useThousandSeperator to a numberfield

Ext.util.Format

like image 142
Akin Okegbile Avatar answered Nov 12 '22 19:11

Akin Okegbile