Sencha touch 2 Can';无法在Sencha Touch中查看存储数据
我试图在SenchaTouch2中显示一个简单数据列表。由于某种原因,它没有显示数据,我无法理解。我得到了两个标题栏:正确的标题和“最近的帖子”,下面是一个空白标题。我不知道为什么会这样。也许这与显示器的其他部分有冲突Sencha touch 2 Can';无法在Sencha Touch中查看存储数据,sencha-touch-2,Sencha Touch 2,我试图在SenchaTouch2中显示一个简单数据列表。由于某种原因,它没有显示数据,我无法理解。我得到了两个标题栏:正确的标题和“最近的帖子”,下面是一个空白标题。我不知道为什么会这样。也许这与显示器的其他部分有冲突 Ext.define('GS.view.NewBlog',{ extend: 'Ext.navigation.View', xtype: 'newblog', requires: [ 'Ext.dataview.List',
Ext.define('GS.view.NewBlog',{
extend: 'Ext.navigation.View',
xtype: 'newblog',
requires: [
'Ext.dataview.List',
'Ext.TitleBar'
],
config: {
title: 'Blog',
iconCls: 'star',
items: {
docked: 'top',
xtype: 'titlebar',
title: 'Recent Posts'
}, // end items
store: {
fields: ['title','author'],
data: [
{title: 'This is the first Title', author: 'John Smith'},
{title: 'This is the second title', author: 'Jane Doe'}
] // end data
} // end store
}, // end config
itemTpl: '{title}'
});
您需要定义一个存储:
Ext.define('GS.store.Posts', {`
extend: 'Ext.data.Store',`
config: {
data: [
{
title: 'This is the first Title',
author: 'John Smith'
},
{
title: 'This is the second title',
author: 'Jane Doe'
}
],
storeId: 'Posts',
fields: [
{
name: 'title'
},
{
name: 'author'
}
]
}
});
使用存储定义具有列表的面板:
Ext.define('GS.view.NewBlog', {
extend: 'Ext.Panel',
alias: 'widget.NewBlog',
config: {
layout: {
type: 'card'
},
items: [
{
xtype: 'toolbar',
docked: 'top',
title: 'Recent Posts'
},
{
xtype: 'list',
itemTpl: [
'<div>{title} - {author}</div>'
],
store: 'Posts'
}
]
}
});
您的视图中没有列表。正确的?
Ext.Loader.setConfig({
enabled: true
});
Ext.application({
stores: [
'Posts'
],
views: [
'NewBlog'
],
name: 'GS',
launch: function() {
Ext.create('GS.view.NewBlog', {fullscreen: true});
}
});