Sencha Touch:一层嵌套列表?

发布于 2024-12-03 04:51:46 字数 1543 浏览 1 评论 0原文

我想知道是否可以在嵌套列表的第一层显示子叶?

在旁边的示例中,我想在您选择“我的类别”(最后一项)时显示一个页面,但如果我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

煮酒 2024-12-10 04:51:46

叶子“我想在子叶子上显示的文本”没有父元素(实际上它的“父元素”是树的根元素)。

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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文