PDA

View Full Version : Problems with JSONP



pokiekokie
4 Feb 2011, 7:10 AM
Hello, i am trying to store data in a store from a JSONP file and display the data with a dataview. The JSONP file is a YQL url, and returns the right object:

'stcCallback1001({"query":{"count":0,"created":"2011-02-04T15:07:05Z","lang":"en-US","results":null}});'

So, according to the ScriptTage description in the API docs, it should work, but nothing appears on my screen. Does anyone know why?

Code://////

Ext.setup({
onReady: function() {



Ext.regModel('Test', {
fields: [
{name:'lang', type: 'string'},

]
});

var store = new Ext.data.Store({
model : 'Test',

proxy : {
type: 'scripttag',
url : "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D'http%3A%2F%2Fws.geonames.org%2Ftimezone%3Flat%3D33%26lng%3D33'&format=json",

reader : {
type : 'json',
root: 'query'
}
},
autoLoad : true

});

var tpl = new Ext.XTemplate(

'<tpl for=".">',
'<div class="werkt">',
'<p><strong>{lang}</strong></P>',
'</div>' ,
'</tpl>'
)





var feedView = new Ext.DataView({

store:store,

tpl: tpl,
itemSelector:'div.werkt'


})


var container = new Ext.Panel({
layout: 'fit',
fullscreen:true,
animation: {
type: 'fade',
cover: true
},
items: [feedView]

})







/////