jsonp - How to load data from external JSON into carousel -


guys. i've started playing sencha touch , i've hit wall in first attempt create simple app read json file , put content carousel cell (there 6).

here code far:

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'                 // want json data here instead of html text               },{                 html: 'arena west',                 cls: 'card card2'             },{                 html: 'Арена 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'         }]     }); } 

});

and here json file:

{ "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": "Запознай се с малките"     } ] 

}

so want load file, parse , put in first carousel "cell" (and later populate other "cells"). i've looked @ documentation cannot figure how it. appreciated.

thanks in advance.

there's no need use jsonp load if you're on same domain. use ext.ajax.request. there example of loading carousel content xml, idea same.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -