Sencha Touch:一层嵌套列表?
我想知道是否可以在嵌套列表的第一层显示子叶?
在旁边的示例中,我想在您选择“我的类别”(最后一项)时显示一个页面,但如果我使用 getDetailCard 函数,我会遇到父问题。消息是:
“'未定义'不是一个对象(评估'parent.attributes.record.data')”
数据
var data = {
text: 'Groceries',
items: [{
text: 'WATER',
items: [{
text: 'Water',
items: [{
text: 'Sparkling',
info : 'THIS TEXT IS SHOWN IN THE CHILD LEAF',
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: 'My Category',
info : 'TEXT I WANT TO SHOW ON A CHILD LEAF',
leaf: true
}]
};
模型&商店:
Ext.regModel('ListItem', {
fields: [
{name: 'text', type: 'string'},
{name: 'info', type: 'string'}
]
});
var store = new Ext.data.TreeStore({
model: 'ListItem',
root: data,
proxy: {
type: 'ajax',
reader: {
type: 'tree',
root: 'items'
}
}
});
感谢您的帮助,问候。
I'd like to know if it's possible to show a child leaf on the first level on a nestedlist ?
On the example beside, i'd like to show a page when you select "MY CATEGORY" (the last item) but I have a parent issue if i use the getDetailCard function. the message is :
"'undefined' is not an object (evaluating 'parent.attributes.record.data')"
DATA
var data = {
text: 'Groceries',
items: [{
text: 'WATER',
items: [{
text: 'Water',
items: [{
text: 'Sparkling',
info : 'THIS TEXT IS SHOWN IN THE CHILD LEAF',
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: 'My Category',
info : 'TEXT I WANT TO SHOW ON A CHILD LEAF',
leaf: true
}]
};
MODEL & STORE :
Ext.regModel('ListItem', {
fields: [
{name: 'text', type: 'string'},
{name: 'info', type: 'string'}
]
});
var store = new Ext.data.TreeStore({
model: 'ListItem',
root: data,
proxy: {
type: 'ajax',
reader: {
type: 'tree',
root: 'items'
}
}
});
Thanks for your help, regards.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
叶子“我想在子叶子上显示的文本”没有父元素(实际上它的“父元素”是树的根元素)。
The leaf 'TEXT I WANT TO SHOW ON A CHILD LEAF' don't have a parent (actually it's 'parent' is the root element of the tree).