Dynamic Store using metadata Null model and fields
Hi I'm having an issue with my store using metadata. I get null values for model and fields when i do store.getFields() or store.getModel(). The store contains the relevant data in this case the users but the model and fields of the store is null. I would like to know what I'm missing in order to populate the fields and model. Thanks
I'm using json similar to the following for testing.
{"count":1,
"ok":true,
"msg":"Users found",
"users":[{"userId":123,"name":"Ed Spencer","email":"ed@sencha.com"}],
"metaData":{"idProperty":'userId',"rootProperty":"users","totalProperty":'count',"successProperty":'ok',"messageProperty":'msg', "fields":[ { "name": "userId", "type": "int" }, { "name": "name", "type": "string" }, { "name": "email", "type": "string" }
] }}
My ModelExt.define('DST.model.DynamicModel', {
extend: 'Ext.data.Model',
config: {
fields: []
}
});
My Store
Ext.define('DST.store.DynamicStore', {
extend: 'Ext.data.Store',
config:{
model: 'DST.model.DynamicModel',
proxy: {
type: 'ajax',
url: 'app/data/dynamictest.json',
reader: {
type: 'json',
idProperty: 'id',
rootProperty: 'root',
totalProperty: 'total',
successProperty: 'success',
messageProperty: 'message'
},
timeout: 10000
}
}
});