开发者

Sencha Touch : Nested List with one level?

开发者 https://www.devze.com 2023-04-03 07:18 出处:网络
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 ha

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,
p开发者_StackOverflow中文版roxy: {
    type: 'ajax',
    reader: {
        type: 'tree',
        root: 'items'
    }
}
});

Thanks for your help, regards.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号