I am trying to read json data from a rest service into a data store in my Sencha Android application. When I add the data directly to the store the application launches on my emulator and works fine. However, when I replace the data with a proxy call to my rest service as shown in the view I have provided, all I get is a blue screen with three blinking dots.
I have also tried using jsonp type at the proxy instead of rest as well as adding autoLoad: 'true'.
What could be the problem and how can I resolve this?
Here is my view:
Code:
Ext.define('MyApp.view.BigStoryList',{
extend: 'Ext.List',
xtype: 'bigStoryList',
id: 'bigStoryListView',
config: {
xtype: 'list',
scrollable: {
direction: 'vertical'
},
store: Ext.create('MyApp.store.BigStoryList'),
itemTpl: '<div>'
+ '<img class="big-image" src="{ImageURL}"/>'
+ '<h5 class="category-label {Category}"><span>{Category}</span></h5>'
+ '<h5 class="big-story-title"><span>{Title}</span></h5>'
+ '</div>'
}
});
Here is my data store:
Code:
Ext.define('MyApp.store.BigStoryList', {
extend : 'Ext.data.Store',
config : {
model: 'MyApp.model.BigStoryList',
proxy: {
type: 'rest',
url : 'http://myUrl:8080/myRestService/webresources/service?category=all',
reader: {
type: 'json',
root: 'News'
}
}
}
});
Here is my model:
Code:
Ext.define('MyApp.model.BigStoryList', {
extend : 'Ext.data.Model',
config : {
fields : [{
name : 'Title',
type : 'string'
}, {
name : 'ImageURL',
type : 'string'
}, {
name : 'Category',
type : 'string'
}]
}
});
And here is what my json data looks like:
Code:
{
"News": [{
"Title": "A title",
"Link": "http://myUrl/news/some-story-article/",
"Date": "Mon, 30 May 2016 05~00~02 +0000",
"Author": "an author",
"ImageURL": "http://myUrl/myImage.jpg",
"Content": "Some content goes here",
"Category": "category1"
}, {
"Title": "A title",
"Link": "http://myUrl/news/some-story-article/",
"Date": "Sun, 29 May 2016 15~40~12 +0000",
"Author": "an author",
"ImageURL": "http://myUrl/myImage.jpg",
"Content": "Some content goes here",
"Category": "category2"
}]
}
Thank you.