我正在Sencha Touch 2中使用PhoneGap包裝器構建應用程序。 我在MVC模式的編碼,這裏是應用程序的Web服務器的鏈接(調試運行):http://nqatalog.negroesquisso.pt/APP/登錄:用戶名:1,密碼:1NestedList不會呈現
我有一個嵌套列表與TreeStore加載其數據,和.json文件與數據。
型號
Ext.define('APP.model.menuitem',{
extend: 'Ext.data.Model',
condig: {
fields: ['id', 'name', 'description', 'items']
}
});
商店
Ext.define('APP.store.nestedmenu', {
extend: 'Ext.data.TreeStore',
config: {
model: 'APP.model.menuitem',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'data/menu.json',
reader: {
type: 'json',
rootProperty: 'items'
}
}
}
});
查看
Ext.define('APP.view.MenuNestedList', {
extend: 'Ext.dataview.NestedList',
xtype: 'menunestedlist',
id: 'debug',
config: {
store: 'nestedmenu'
},
});
另一種觀點,稱前一個
Ext.define("APP.view.Leftmenu", {
extend: 'Ext.Panel',
xtype: 'leftmenu',
config: {
items: [
{
xtype: 'menunestedlist'
}
],
listeners: {
painted: function() {
}
},
},
onleafitemtap: function() {}
});
這個嵌套列表呈現爲空(正如你可以看到和調試,如果你想在上面的鏈接)
謝謝你的時間。
* EDIT(數據/ menu.json)
{
"items": [
{
"id": 1,
"name": "Section #1",
"description": "Lorem ipsum dolor sit",
"items": [
{
"id": 8,
"name": "Product #1",
"description": "Lorem ipsum dolor sit",
"leaf": true
},
{
"id": 9,
"name": "Product #2",
"description": "Lorem ipsum dolor sit",
"leaf": true
}
]
},
{
"id": 2,
"name": "Section #2",
"description": "Lorem ipsum dolor sit",
"items": [
{
"id": 3,
"name": "Section #3",
"description": "Lorem ipsum dolor sit",
"items": [
{
"id": 10,
"name": "Product #3",
"description": "Lorem ipsum dolor sit",
"leaf": true
},
{
"id": 11,
"name": "Product #4",
"description": "Lorem ipsum dolor sit",
"leaf": true
}
]
},
{
"id": 4,
"name": "Section #4",
"description": "Lorem ipsum dolor sit",
"items": [
{
"id": 12,
"name": "Product #5",
"description": "Lorem ipsum dolor sit",
"leaf": true
},
{
"id": 13,
"name": "Product #6",
"description": "Lorem ipsum dolor sit",
"leaf": true
}
]
},
{
"id": 5,
"name": "Section #5",
"description": "Lorem ipsum dolor sit",
"items": [
{
"id": 14,
"name": "Product #7",
"description": "Lorem ipsum dolor sit",
"leaf": true
}
]
},
{
"id": 6,
"name": "Section #6",
"description": "Lorem ipsum dolor sit",
"items": [
{
"id": 15,
"name": "Product #8",
"description": "Lorem ipsum dolor sit",
"leaf": true
},
{
"id": 16,
"name": "Product #9",
"description": "Lorem ipsum dolor sit",
"leaf": true
},
{
"id": 17,
"name": "Product #10",
"description": "Lorem ipsum dolor sit",
"leaf": true
}
]
}
]
},
{
"id": 7,
"name": "Section #7",
"description": "Lorem ipsum dolor sit",
"items": [
{
"id": 18,
"name": "Product #11",
"description": "Lorem ipsum dolor sit",
"leaf": true
},
{
"id": 19,
"name": "Product #12",
"description": "Lorem ipsum dolor sit",
"leaf": true
},
{
"id": 20,
"name": "Product #13",
"description": "Lorem ipsum dolor sit",
"leaf": true
}
]
}
]
}
嗨。我在我的Leftmenu視圖中添加了'layout:fit'。現在列表樹呈現,但沒有文字apears。檢查它在我的網絡服務器。 – Ricardo 2012-03-30 16:56:39
用它更新了原文。謝謝你的時間。 – Ricardo 2012-03-30 17:07:48
我只是將關鍵字「名稱」更改爲「文本」,它的工作原理。它看起來像鑰匙必須特別是集合的「項目」和名稱或描述的「文本」。請確保您在模型定義中的字段列表中更改它。 – 2012-03-30 17:15:40