JakeLatham
5 Sep 2012, 1:18 PM
I'm wondering if I can override the default field conversion routines, rather than having to do it in each field.
For example, in our app, we have a lot of legacy code that returns "True" or "Yes" to what are boolean fields. rather than use ExtJS's built in parse for a 'bool' type field, I'd like to use my own convert function. However, rather than specify it every time:
...
{ name: 'copy', type: 'boolean', defaultValue: true, convert: BooleanUtilities.parse }, //some routine I wrote...
...
I'd like to be able to somehow override whatever does the type conversion for 'bool' type fields. Is this possible?
A similar case is where we have some legacy code that returns formatted integers for floats, such as "1,234" or "1,234.56". the standard int and float routines do not work for these, so I'd like to be able to do something like:
...
{ name: 'someValueField', type: 'float', defaultValue: true, convert: NumberUtilities.parse }, //can handle 1,234
...
Also, I noticed that when you specify a "convert", the field gets moved to the end of the field list, is there a way to prevent this?
-Jake
For example, in our app, we have a lot of legacy code that returns "True" or "Yes" to what are boolean fields. rather than use ExtJS's built in parse for a 'bool' type field, I'd like to use my own convert function. However, rather than specify it every time:
...
{ name: 'copy', type: 'boolean', defaultValue: true, convert: BooleanUtilities.parse }, //some routine I wrote...
...
I'd like to be able to somehow override whatever does the type conversion for 'bool' type fields. Is this possible?
A similar case is where we have some legacy code that returns formatted integers for floats, such as "1,234" or "1,234.56". the standard int and float routines do not work for these, so I'd like to be able to do something like:
...
{ name: 'someValueField', type: 'float', defaultValue: true, convert: NumberUtilities.parse }, //can handle 1,234
...
Also, I noticed that when you specify a "convert", the field gets moved to the end of the field list, is there a way to prevent this?
-Jake