Sencha touch 2 Sencha列表不显示任何数据
我有一个ProfileView,它应该显示一些用户数据。这是我第一次尝试从MySql获取数据并在Sencha视图上显示它 视图Sencha touch 2 Sencha列表不显示任何数据,sencha-touch-2,Sencha Touch 2,我有一个ProfileView,它应该显示一些用户数据。这是我第一次尝试从MySql获取数据并在Sencha视图上显示它 视图 Ext.define('MyApp.view.Profile', { extend : 'Ext.Panel', xtype : 'profileview', requires : ['Ext.List', 'Ext.data.Store'], config : { layout: 'fit', title : 'Profiel', icon
Ext.define('MyApp.view.Profile', {
extend : 'Ext.Panel',
xtype : 'profileview',
requires : ['Ext.List', 'Ext.data.Store'],
config : {
layout: 'fit',
title : 'Profiel',
iconCls : 'user3',
cls : 'home',
scrollable : true,
styleHtmlContent : true,
html : ['<h1>Mijn Profiel</h1>'].join(""),
items : [Ext.create('Ext.List', {
title : 'Profile',
docked : 'top',
store : myStore,
show : function(list, opts) {
alert('list === ' + list);
console.log('List Shown: ' + list);
}
})]
}
数据返回正确,但没有显示任何内容,我正试图弄清楚这一点
回应
[{"ID":"19","USERNAME":"Annet","EMAIL":"annet@annet.nl"}]
我跳过了rootProperty,因为它是单个用户
模型
Ext.define('MyApp.model.User', {
extend : 'Ext.data.Model',
config : {
fields : [{
name : 'ID',
type : 'int'
}, {
name : 'USERNAME',
type : 'string'
}, {
name : 'EMAIL',
type : 'string'
}]
}
}))
那么,为什么列表没有显示任何内容
更新
[{"ID":"19","USERNAME":"Annet","EMAIL":"annet@annet.nl"}]
我检查以查看存储是否包含数据,它确实包含数据
map: Object
ext-record-1: Class
_data: Object
EMAIL: "annet@annet.nl"
ID: 19
USERNAME: "Annet"
id: "ext-record-1"
__proto__: Object
为什么没有被列入名单?我也尝试了DataView。您需要使用,我为您更改了代码
Ext.define('MyApp.view.Profile', {
extend : 'Ext.Panel',
xtype : 'profileview',
requires : ['Ext.List', 'Ext.data.Store'],
config : {
layout: 'fit',
title : 'Profiel',
iconCls : 'user3',
cls : 'home',
scrollable : true,
styleHtmlContent : true,
html : ['<h1>Mijn Profiel</h1>'].join(""),
items : [Ext.create('Ext.List', {
title : 'Profile',
docked : 'top',
itemTpl : '<div>{ID} <span> {USERNAME} </span> <span> {EMAIL} </span> </div>',
store : myStore,
show : function(list, opts) {
alert('list === ' + list);
console.log('List Shown: ' + list);
}
})]
}
});
Ext.define('MyApp.view.Profile'{
扩展:“Ext.Panel”,
xtype:'profileview',
需要:['Ext.List','Ext.data.Store'],
配置:{
布局:“适合”,
标题:“Profiel”,
iconCls:'user3',
cls:“家”,
可滚动:对,
styleHtmlContent:对,
html:['Mijn Profiel'].join(“”),
条目:[Ext.create('Ext.List'{
标题:“个人资料”,
停靠:“顶部”,
itemTpl:“{ID}{USERNAME}{EMAIL}”,
商店:myStore,
显示:功能(列表、选项){
警报(“列表===”+列表);
log('显示的列表:'+列表);
}
})]
}
});
尝试在控制台中登录存储。因此,我们可以找出是存储区中没有数据,还是列表中没有显示数据。还要先检查将一些虚拟数据放在存储中,如果它显示了数据,那么我们就可以确定来自php的数据是否给了我们trouble@SirwaniMayur存储区包含数据,请参阅我的更新。但未执行以下行:console.log('显示的列表:'+列表);aarghhhh,这是一个序列的东西,存储是在视图的定义下创建的,我的基础ExtJS知识在那里缺乏。。。。