PDA

View Full Version : JSONP in carousel



mytrile
8 Feb 2011, 6:45 AM
Hi, guys.

I'm pretty new, so maybe this is a dumb question. I've read the documentation and searched to forum, I didn't found out how to load JSON data into carousel.

My sample app is tiny


Ext.setup({
icon: 'icon.png',
glossOnIcon: false,
onReady: function() {

var arena_zapad = new Ext.Component({
title: 'Arena Zapad',
scroll: 'vertical',
tpl: [
'<tpl for=".">',
'<div class="movie">',
'<h2>{title}</h2>',
'{days}',
'</div>',
'</tpl>'
]
});

var refresh = function() {
Ext.util.JSONP.request({
url: 'http://moviewithme.heroku.com/cinema/mtel_imax.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: '???? ??????',
iconCls: 'monitor2',
xtype: 'carousel',
items: [{
html: '????? ???????',
cls: 'card card1',
},{
html: '????? ?????',
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: '?????',
html: '?????',
iconCls: 'video_black2',
cls: 'card card1'
}, {
title: '????????',
html: '????????',
iconCls: 'photo3',
cls: 'card card3'
}, {
title: '??????',
html: '??????',
iconCls: 'favorites',
cls: 'card card1'
}, {
title: '??????????',
html: '??????????',
iconCls: 'info2',
cls: 'card card5'
}]
});
}
});

The json file:


[
{
"title": "???????? ???????",
"days": "8 ???????? (???????), 15:40, 20:30"
},
{
"title": "????: ???????",
"days": "8 ???????? (???????), 13:10, 18:00, 22:50"
}
]

So I want to load that data in the first carousel item:

{
html: '????? ???????',
cls: 'card card1',
}


Any ideas or documentation to help me ?

Thanks in advance.

Quant
16 Mar 2011, 5:21 PM
I too would like to know how to do this. Can anyone enlighten us?

Thanks in advance, Max

mytrile
7 Apr 2011, 4:29 AM
Hey, guys.

I didn't find a solution for my problem. I'm still looking a way to populate carousel with json data from remote server 8-|

Hertz
7 Apr 2011, 6:23 AM
You might want to give mitchellsimoens's Infinite Carousel a try:

http://www.sencha.com/forum/showthread.php?127923-Ext.ux.touch.InfiniteCarousel-v2.0b1