PDA

View Full Version : [FIXED-25] Model boolean fields don't have a default value (0.82)



rdougan
31 May 2010, 3:27 AM
They are always undefined, which means when they are used in Ext.Templates, an error is produced: "xxx is not defined".

rdougan
3 Jun 2010, 4:52 AM
This actually applies to all types of fields.

Jamie Avins
3 Jun 2010, 8:13 AM
Awesome feedback on the bugs rdougan, if you can do me one small favor and put in the version you are using that would be great. That way if other people have the same problem they know when it was noted and fixed.

rdougan
3 Jun 2010, 8:36 AM
No problem, sorry about that.

edspencer
3 Jun 2010, 11:28 AM
I'll be adding default value capability to all field types shortly

edspencer
8 Jun 2010, 3:29 PM
This has now been added, see Model docs for details

watrboy00
8 Jun 2010, 9:08 PM
Just out of curiosity when you define a model field will you be able to set the default or does it just make one up based on the field's type? I would go and look for myself but as you just commented about this Ed I don't think that version is released as of yet.

edspencer
8 Jun 2010, 11:06 PM
Just out of curiosity when you define a model field will you be able to set the default or does it just make one up based on the field's type? I would go and look for myself but as you just commented about this Ed I don't think that version is released as of yet.

You can set the default value of each field by setting its defaultValue property - like this:



Ext.regModel('User', {
fields: [
{name: 'gender', type: 'string', defaultValue: 'male'},
{name: 'age', type: 'int'}
]
});