Reputation: 688
I am having some problems trying to display child objects using itemtpl property for a list. here is an example of the issue
JSON String:
{"messages" : [{"body":{"special":"some special format", "plain":"plain format"}}]
Model:
Ext.regModel('MyFeed', {
fields: [
{name: 'body'}
]
});
Store:
var FeedStore = new Ext.data.Store({
model: 'MyFeed',
proxy: {
type: 'ajax',
url: 'data.json',
reader: {
type: 'json',
root: 'messages'
}
}
});
List:
var FeedList = new Ext.List({
itemTpl : '<div>{body}</div>',
store: FeedStore,
width: '100%',
style: 'background-color: #dfe2e3',
plugins: [{
ptype: 'pullrefresh'
}]
});
Upvotes: 1
Views: 4437
Reputation: 30092
You could set up a mapping:
Ext.regModel('MyFeed', {
fields: [
{name: 'body'},
{name: 'special', mapping: 'body.special'},
{name: 'plain', mapping: 'body.plain'}
]
});
Upvotes: 2