PDA

View Full Version : [FIXED-187] The model data become undefined.



taka_2
30 Jul 2010, 6:51 AM
// Set up a model to use in our Store
Ext.regModel('User', {
fields: [
{name: 'firstName', type: 'string'},
{name: 'lastName', type: 'string'}
]
});

var user1 = Ext.ModelMgr.create({firstName: 'hoge1', lastName: 'moge1'}, 'User');
document.write(user1.firstName);


Running the code using Sencha Touch 0.91, "hoge1" will be displayed.
But running the code using Sencha Touch 0.92, "undefined" will be displayed.
Appears to have failed to initialize the model.

Jamie Avins
30 Jul 2010, 9:23 AM
Your issue has been entered in trac; thank you for the report.

jeroenvduffelen
3 Aug 2010, 6:39 AM
Well
user1.firstName is a bug in v0.91 as far as I know.

You should use
user1.get('firstName') instead.

taka_2
3 Aug 2010, 7:27 AM
Dear jeroenvduffelen.

Thank you for your answer.

I also confirmed that your code is working with Sencha Touch 0.92.

flashape
4 Aug 2010, 12:21 PM
I was just coming to post this same issue. It works by using the method jeroenvduffelen mentioned, but if it's wrong to do "obj.prop" then it shouldn't be in the examples.

evant
14 Aug 2010, 5:18 AM
The examples have been updated so they use record.get.

Also, if you want to access the raw property, you'd use



user1.data.firstName;