PDA

View Full Version : JSON / Lists / JsonStore & Object has no 'read' method



drew5
16 Feb 2011, 1:53 PM
Brand new to Sencha. Only about a week. So far so good with most of the stuff but I have been having an issue with JsonStore and an error about a no read method. I am assuming the method cannot read the Json that comes back but not sure.



var videoStore = new Ext.data.JsonStore({
autoLoad: true,
proxy: {
type: 'scripttag',
url: 'http://gdata.youtube.com/feeds/api/videos',
extraParams: {
author: 'authorname',
alt: 'json'
},
reader: {
type: 'json',
root: 'entry'
}
}
});
var videoTpl = new Ext.XTemplate(
'<tpl for=".">',
'<div class="video-row">',
'{title}',
'</div>',
'</tpl>'
);

var jsonVideoView = new Ext.DataView({
store: videoStore,
tpl: videoTpl,
autoHeight: true,
itemSelector: 'div.video-row'
});


You can access the JSON using this url if you wish, but I am assuming it is valid since it is YouTube.

http://gdata.youtube.com/feeds/api/videos?_dc=1297892408342&author=homedepot&alt=json&limit=25

The error I get is the following:
Uncaught TypeError: Object #<an Object> has no method 'read'

I see the JSON returned in the console, but it is wrapping the return in a stcCallback1001 callback method. It looks like Sencha is wrapping that since I am not specifying it in the URL.

Any help would be sweet.