Skip to content Skip to sidebar Skip to footer

Thousands Separators In Ext.form.numberfield

I want to override some config options of Ext.form.NumberField, but I don't find something like a 'thousands separator'. Is there a way to define this for NumberFields in Ext? Or

Solution 1:

you can also use this override

Ext.override.ThousandSeparatorNumberField

Solution 2:

On closer inspection according to the forums/devs, NumberField doesn't support formatting. Numbercolumn on a grid does.

Their suggestion is to use a TextField and either format the value serverside before displaying it, or to apply a function on say, the 'change' event of a text field to apply the formatting you want, e.g.

<ext:TextFieldID="txtField"runat="server"FieldLabel="My Label"AllowBlank="false"ReadOnly="true"><Listeners><ChangeHandler="this.setValue(Ext.util.Format.number(newValue.replace(/[\,\.]/g, ''), '0.000/i'));" /></Listeners></ext:TextField>

I would assume you'd need to tweak things a little to ensure your value was displayed as you'd like but there should be something you fit in the Ext.util.Format.number patterns listed here:

http://dev.sencha.com/deploy/ext-3.3.1/docs/output/Ext.util.Format.html#Ext.util.Format-number

Post a Comment for "Thousands Separators In Ext.form.numberfield"