2011-09-05 71 views
0

我想知道是否可以在嵌套列表的第一級上顯示子葉子?Sencha Touch:嵌套列表與一個級別?

在旁邊的例子中,當我選擇「我的類別」(最後一項)時,我想顯示一個頁面,但如果我使用getDetailCard函數,我有一個父問題。該消息是:

「 '未定義' 不是(評價 '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' 
    } 
} 
}); 

感謝您的幫助,問候。

回答

0

葉'我想要展示在兒童葉'上的文字沒有父親(實際上'父'是樹的根元素)。