PDA

View Full Version : How to display nested JSON data with Ext.grid.Panel



AMuhammad
12 Dec 2011, 11:52 PM
Can any one help me with this. How can i display nested JSON with grid panel.
Following is my JSON

[
{
name: "Computers",
description: "Computers",
active: true,
categories: [
{
name: "EReader",
description: "EReader",
active: true,
categoryId: 31
},
{
name: "Laptop",
description: "Laptop",
active: true,
categoryId: 1
}
],
catalogCategoryid: 1
},
{
name: "Home Applicances",
description: "Home Applicances",
active: true,
categories: [
{
name: "Faxes",
description: "Faxes",
active: true,
categoryId: 9
}
],
catalogCategoryid: 2
}
]

This is my model

Ext.define('CMS.model.CatalogCategory', {
extend: 'Ext.data.Model',
fields: ['name', 'description', 'active', 'catalogCategoryid', 'categories'],
hasMany: {model: 'Category', name: 'categories'}
});
I get nested data populated but how can i display it.

tobiu
13 Dec 2011, 3:16 AM
please use code tags next time, makes it way easier to read.

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.grid.column.Column-cfg-renderer
is your friend for this issue.