我正在使用帶有基礎TreeStore的NestedList。現在我想將項目添加到NestedList作爲葉子。 我該怎麼做?Sencha Touch 2:插入到TreeStore /嵌套列表
目前我的代碼(控制器,onAddButtonTapped)看起來是這樣的:
var store = Ext.getStore('menuStore');
var customerAreaNode = store.getRoot().getChildAt(1);
customerAreaNode.appendChild({name: "text", leaf:true});
customerAreaNode.expand();
store.sync();
此代碼導致在葉級兩個新的空listentries(正確的節點後面),並在節點級一個新的一個ListEntry。 每個新條目都沒有名稱顯示在嵌套列表中,但每個條目都在其名稱字段中包含「文本」。奇怪的是,葉級的新條目中沒有一個輸入到底層模型中。因此,相應的模型的方法便無法找到:
Uncaught TypeError: Cannot call method 'getSelectedName' of undefined
有誰知道一個簡單的教程如何將數據添加到NestedList/TreeStore?我無法在sencha touch文檔中找到一個很好的例子。
這可能幫助:http://stackoverflow.com/questions/9655201/update-a-nested-list-in -sencha-touch-2 ---即時通訊在我的手機上,所以我無法測試代碼,看看是否讓你開始 – 2012-08-15 14:03:48