Sencha touch 2 Sencha Touch 2:在选项卡面板中添加嵌套列表
我试图在选项卡面板中插入NestedList,但得到一个空列表,内容不显示。如何使此Neestedlist可见 我试过的代码: 提前感谢您的帮助Sencha touch 2 Sencha Touch 2:在选项卡面板中添加嵌套列表,sencha-touch-2,Sencha Touch 2,我试图在选项卡面板中插入NestedList,但得到一个空列表,内容不显示。如何使此Neestedlist可见 我试过的代码: 提前感谢您的帮助 Ext.define('ListItem', { extend: 'Ext.data.Model', config: { fields: ['text'] } }); var treeStore = Ext.create('Ext.data.TreeStore', { model: 'ListItem'
Ext.define('ListItem', {
extend: 'Ext.data.Model',
config: {
fields: ['text']
}
});
var treeStore = Ext.create('Ext.data.TreeStore', {
model: 'ListItem',
defaultRootProperty: 'items',
root: {
items: [
{
text: 'Drinks',
items: [
{
text: 'Water',
items: [
{ text: 'Still', leaf: true },
{ text: 'Sparkling', leaf: true }
]
},
{ text: 'Soda', leaf: true }
]
},
{
text: 'Snacks',
items: [
{ text: 'Nuts', leaf: true },
{ text: 'Pretzels', leaf: true },
{ text: 'Wasabi Peas', leaf: true }
]
}
]
}
});
Ext.create('Ext.NestedList', {
fullscreen: true,
store: treeStore
});
Ext.application({
name: 'Sencha',
launch: function() {
// The whole app UI lives in this tab panel
Ext.Viewport.add({
requires: ['Ext.List', 'Ext.dataview.List', 'Ext.data.proxy.JsonP'],
xtype: 'tabpanel',
fullscreen: true,
tabBarPosition: 'bottom',
items: [
// This is the recent blogs page. It uses a tree store to load its data from blog.json.
{
xtype: 'nestedlist',
title: 'Blog',
iconCls: 'star',
cls: 'blog',
displayField: 'title',
store: treeStore
}
]
});
}
});
在所提供代码的底部,您正在创建的嵌套列表中设置一个值为“title”的displayfield属性。因此,列表试图使用模型中不存在的“title”字段。将存储数据更改为使用“title”而不是“text”,或者删除displayField属性(默认值已经是“text”)