在下面的代码中,我在嵌套列表中获取静态数据。但是代替静态数据,我想要动态数据,即从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 }
]
},
]
},
]
}
}
});