I have made an application that fetches news from an external site.
I use a list that recalls items from a JsonP, with this store:
Ext.define('Grottaglie.store.Articoli', {
extend: 'Ext.data.Store',
requires: [
'Grottaglie.model.Articolo'
],
config: {
autoLoad: true,
model: 'Grottaglie.model.Articolo',
storeId: 'articoliStore',
proxy: {
type: 'jsonp',
url: 'http://www.grottaglie24.it/rss/lastarticle.php?callback=callback1',
callbackKey: 'callback1',
reader: {
type: 'json',
idProperty: 'id'
}
}
}
});
This JsonP has an id that I want to use to bring up the detail through another JsonP which contains only the details of each item in the list:
The view code:
Ext.define('Grottaglie.view.Main', {
extend: 'Ext.navigation.View',
config: {
id: 'mainView',
items: [
{
xtype: 'list',
title: 'Grottaglie24',
itemId: 'articoli',
store: 'articoliStore',
itemTpl: '{id} {text}',
listeners: {
select: function(view, record) {
Ext.getCmp('mainView').push({
title: 'Politica',
xtype: 'panel',
store: Ext.create('Ext.data.Store', {
fields: ['title'],
proxy: {
type: 'jsonp',
url: 'http://www.grottaglie24.it/rss/article.php?callback=callback' + record.get('id'),
callbackKey: 'callback' + record.get('id'),
reader: {
type: 'json',
}
},
autoLoad: true
}),
html: '{title}'
});
}
}
}
]
}
});
So I call "articoliStore" to the main list, and as you can see in the "listeners" I create a new store that refers to a jsonp just to detail, in this case only the title of the news. For example this url: http://www.grottaglie24.it/rss/article.php?callback=callback621
I am successful to recall the id with the callback, but when I tap on the item of the list do not show anything. For example if I tap on the item with "id"= 698 I get the following error: TypeError: 'undefined' is not a function (evaluating 'Ext.data.JsonP.callback698({"title": "Here the title of the news......"})')
Why it recognizes the "id" and invokes the callback but I do not show anything?
Thank you very much.