PHP Code:
Ext.setup({
onReady: function () {
// store with data
var data = {
text: 'Groceries',
items: [{
text: 'Drinks',
items: [{
text: 'Water',
items: [{
text: 'Sparkling',
leaf: true
}, {
text: 'Still',
leaf: true
}]
}, {
text: 'Coffee',
leaf: true
}, {
text: 'Espresso',
leaf: true
}, {
text: 'Redbull',
leaf: true
}, {
text: 'Coke',
leaf: true
}, {
text: 'Diet Coke',
leaf: true
}]
}, {
text: 'Fruit',
items: [{
text: 'Bananas',
leaf: true
}, {
text: 'Lemon',
leaf: true
}]
}, {
text: 'Snacks',
items: [{
text: 'Nuts',
leaf: true
}, {
text: 'Pretzels',
leaf: true
}, {
text: 'Wasabi Peas',
leaf: true
}]
}, {
text: 'Empty Category',
items: []
}]
};
Ext.regModel('ListItem', {
fields: [{
name: 'text',
type: 'string'
}]
});
var store = new Ext.data.TreeStore({
model: 'ListItem',
root: data,
proxy: {
type: 'ajax',
reader: {
type: 'tree',
root: 'items'
}
}
});
var nestedList = new Ext.NestedList({
fullscreen: true,
title: 'Groceries',
displayField: 'text',
store: store
});
var appPanel = new Ext.Panel({
id: 'appPanel',
fullscreen: true,
dockedItems: {
xtype: 'tabpanel',
layout: {
pack: "center"
},
fullscreen: true,
items: [{
title: 'test1',
html: '<p>test 1</p>'
}, {
title: 'NestedList',
dockedItems: nestedList
}, {
title: 'test3',
html: '<p>test 3</p>'
}]
}
});
} // end onReady
});