0
我不熟悉sencha touch,所以如果有人能指出我會朝着正確的方向發展,那將會很棒。我的問題是我想顯示來自我的數據庫的數據。我似乎擁有了一切工作正常,當我檢查我看到的數據元素,但我無法看到屏幕下面的數據是我的代碼:無法在屏幕上看到數據,但我可以在元素中看到它
getUserList.js
Ext.regModel("User", {
fields: [
"id",
"name",
"username",
"password",
"email",
"phone"
]
});
var myStore = new Ext.data.Store({
model: 'User',
proxy: {
type: 'ajax',
url : '../sencha/php/getUserList.php',
reader: {
type: 'json',
root: 'results'
}
},
autoLoad: true
});
var tpl = new Ext.XTemplate(
'<tpl for=".">',
'<div class="thumb-wrap" id="{id}">',
'<div class="thumb">title="{name}"></div>',
'<span class="x-editable">{name}</span></div>',
'<div style="background-color:#00F" class="thumb-wrap" id="{id}">{id}</div>',
'</tpl>',
'<div class="x-clear"></div>'
);
var panel = new Ext.extend(Ext.Panel,{
id:'images-view',
frame:true,
width:535,
autoHeight:true,
collapsible:true,
layout:'fit',
title:'Simple DataView',
initComponent: function() {
panel.superclass.initComponent.call(this);
},
items: new Ext.DataView({
store: myStore,
tpl: tpl,
autoHeight:true,
multiSelect: true,
overItemCls:'x-view-over',
itemSelector:'div.thumb-wrap',
emptyText: 'No images to display'
})
});
//panel.render(Ext.getBody());
Ext.reg('userPanel', panel);
的index.html
<!DOCTYPE html>
用戶
<script type="text/javascript" src="sencha/sencha-touch.js"></script>
<script type="text/javascript" src="js/getUserList.js"></script>
<link href="sencha/resources/css/sencha-touch.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var topPanel = {
style: 'padding:15px; background-color: #F00',
html: 'color2'
};
new Ext.Application({
launch: function() {
new Ext.Panel({
fullscreen: true,
layout: {
type: 'hbox',
align: 'stretch'
},
items:[{
xtype: 'userPanel'
}],
dockedItems: [topPanel]
});
}
});
</script>
</head>
<body></body>
感謝您提供任何幫助!