次のコードでは、ネストされたリストの静的データを取得します。しかし、静的データの代わりに、動的データ、つまりjspから取得したデータが必要です。どうすればいいのかわかりません。
Ext.define('SenchaApp.store.Items', {
extend: 'Ext.data.TreeStore',
config: {
model: 'SenchaApp.model.Item',
defaultRootProperty: 'items',
root: {
items: [
{
text: 'Categories1',
items: [
{
text: 'Subcategories1',
items: [
{ text: 'Product1', leaf: true },
{ text: 'Product2', leaf: true },
{ text: 'Product3', leaf: true },
{ text: 'Product4', leaf: true }
]
},
{
text: 'Subcategories2',
items: [
{ text: 'Product1', leaf: true },
{ text: 'Product2', leaf: true },
{ text: 'Product3', leaf: true },
{ text: 'Product4', leaf: true }
]
},
{
text: 'Subcategories3',
items: [
{ text: 'Product1', leaf: true },
{ text: 'Product2', leaf: true },
{ text: 'Product3', leaf: true },
{ text: 'Product4', leaf: true }
]
},
{
text: 'Subcategories4',
items: [
{ text: 'Product1', leaf: true },
{ text: 'Product2', leaf: true },
{ text: 'Product3', leaf: true },
{ text: 'Product4', leaf: true }
]
},
]
},
{
text: 'Categories2',
items: [
{
text: 'Subcategories1',
items: [
{ text: 'Product1', leaf: true },
{ text: 'Product2', leaf: true },
{ text: 'Product3', leaf: true },
{ text: 'Product4', leaf: true }
]
},
{
text: 'Subcategories2',
items: [
{ text: 'Product1', leaf: true },
{ text: 'Product2', leaf: true },
{ text: 'Product3', leaf: true },
{ text: 'Product4', leaf: true }
]
},
{
text: 'Subcategories3',
items: [
{ text: 'Product1', leaf: true },
{ text: 'Product2', leaf: true },
{ text: 'Product3', leaf: true },
{ text: 'Product4', leaf: true }
]
},
{
text: 'Subcategories4',
items: [
{ text: 'Product1', leaf: true },
{ text: 'Product2', leaf: true },
{ text: 'Product3', leaf: true },
{ text: 'Product4', leaf: true }
]
},
]
},
{
text: 'Categories3',
items: [
{
text: 'Subcategories1',
items: [
{ text: 'Product1', leaf: true },
{ text: 'Product2', leaf: true },
{ text: 'Product3', leaf: true },
{ text: 'Product4', leaf: true }
]
},
{
text: 'Subcategories2',
items: [
{ text: 'Product1', leaf: true },
{ text: 'Product2', leaf: true },
{ text: 'Product3', leaf: true },
{ text: 'Product4', leaf: true }
]
},
{
text: 'Subcategories3',
items: [
{ text: 'Product1', leaf: true },
{ text: 'Product2', leaf: true },
{ text: 'Product3', leaf: true },
{ text: 'Product4', leaf: true }
]
},
{
text: 'Subcategories4',
items: [
{ text: 'Product1', leaf: true },
{ text: 'Product2', leaf: true },
{ text: 'Product3', leaf: true },
{ text: 'Product4', leaf: true }
]
},
]
},
{
text: 'Categories4',
items: [
{
text: 'Subcategories1',
items: [
{ text: 'Product1', leaf: true },
{ text: 'Product2', leaf: true },
{ text: 'Product3', leaf: true },
{ text: 'Product4', leaf: true }
]
},
{
text: 'Subcategories2',
items: [
{ text: 'Product1', leaf: true },
{ text: 'Product2', leaf: true },
{ text: 'Product3', leaf: true },
{ text: 'Product4', leaf: true }
]
},
{
text: 'Subcategories3',
items: [
{ text: 'Product1', leaf: true },
{ text: 'Product2', leaf: true },
{ text: 'Product3', leaf: true },
{ text: 'Product4', leaf: true }
]
},
{
text: 'Subcategories4',
items: [
{ text: 'Product1', leaf: true },
{ text: 'Product2', leaf: true },
{ text: 'Product3', leaf: true },
{ text: 'Product4', leaf: true }
]
},
]
},
]
}
}
});