我正在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