PDA

View Full Version : [4.0] Ext.data.reader.Json - useSimpleAccessors doesnt work properly



cntx
23 May 2011, 5:38 AM
Hey,

ive notice that the useSimpleAccessors property for readers doesnt work properly.

My case:
Ive got an api rest call which results in the following data


{
metaData: {
fields: ['abc.de', 'def.de']
},
data: {
...
}
}


Because of that response, the model fields will be updated with the given field from metaData.
Fine so far.

Then i have setup my store with the following settings


Ext.define('App.store.Bla', {
extend: 'Ext.data.Store',

autoLoad: false,
fields: [],

proxy: {
type: 'rest',
url: ...,
reader: {
type: 'json',
root: 'data',
useSimpleAccessors: true
}
}
});


According to the API the useSimpleAccessors will force the createAccessor method to use
obj[expr] / obj['abc.de'] instead of obj.abc.de

But thats not happening.
The creating of the accessors will fail with an error.

BUT
If i do another setup


Ext.define('App.store.Bla', {
extend: 'Ext.data.Store',

autoLoad: false,
fields: ['abc.de', 'def.de'],

proxy: {
type: 'rest',
url: ...,
reader: {
type: 'json',
root: 'data',
useSimpleAccessors: true
}
}
});


and without the metaData response, this flag works fine.
greets

PS: just for u to know, i dont know how many fields the response will have, to i cant set them up in front.