夥計們。我已經開始使用Sencha Touch進行遊戲了,並且在第一次嘗試創建簡單的應用程序(閱讀JSON文件,然後將內容放入傳送帶單元格中(有6個應用程序))時,我碰壁了。如何將外部JSON的數據加載到輪播中
這裏是到目前爲止的代碼:
Ext.setup({
icon: 'icon.png',
glossOnIcon: false,
phoneStartupScreen: 'phone_startup.png',
onReady: function() {
var arena_zapad = new Ext.Component({
title: 'Arena Zapad',
scroll: 'vertical',
tpl: [
'<tpl for=".">',
'<div class="movie">',
'<div class="title"><h2>{title}</h2></div>',
'<div class="days">{days}</div>',
'</div>',
'</tpl>'
]
});
var refresh = function() {
Ext.util.JSONP.request({
url: 'arena_zapad.json',
callbackKey: 'callback',
callback: function(data) {
arena_zapad.update(data)
}
})
}
new Ext.TabPanel({
fullscreen: true,
tabBar: {
dock: 'bottom',
layout: {pack: 'center'}
},
animation: 'slide',
items: [{
title: 'Movie Theaters',
iconCls: 'monitor2',
xtype: 'carousel',
items: [
{ html: "Arena Mladost",
cls: 'card card2'
// I want the json data here instead of html text
},{
html: 'Arena West',
cls: 'card card2'
},{
html: 'Арена The Mall',
cls: 'card card3'
},{
html: 'Cineplex',
cls: 'card card3'
},{
html: 'Cinema City',
cls: 'card card3'
},{
html: 'M-TEL IMAX',
cls: 'card card3'
}]
}, {
title: 'Movies',
html: 'Movies',
iconCls: 'video_black2',
cls: 'card card1'
}, {
title: 'Premier',
html: 'Premier',
iconCls: 'photo3',
cls: 'card card3'
}, {
title: 'Favourites',
html: 'Favourites',
iconCls: 'favorites',
cls: 'card card1'
}, {
title: 'About',
html: 'About',
iconCls: 'info2',
cls: 'card card5'
}]
});
}
});
這裏是JSON文件:
{
"movies": [
{
"days": "Digital: 12:15, 14:15, 16:15, 18:15, 20:15, 22:15 35MM: 11:15, 13:15, 15:15, 17:15, 19:15, 21:15, 23:15",
"title": "TILT"
},
{
"days": "9 февруари (сряда), 13:10, 15:30, 17:50, 19:00, 20:10, 21:20, 22:30",
"title": "Бурлеска"
},
{
"days": "9 февруари (сряда), 12:00, 16:15",
"title": "Запознай се с малките"
}
]
}
所以基本上我想加載該文件,分析它,並把它放在第一旋轉木馬「細胞」(後來填充其他「細胞」)。我已經看過文檔,但我不知道如何去做。任何幫助將不勝感激。
在此先感謝。
你能指點一下嗎?我無法在任何地方找到它 – 2011-03-04 08:07:51