PDA

View Full Version : JSON Store not loading when added to Home Screen



cherbert
25 Aug 2011, 6:15 AM
I have a weird problem whereby my JSON data store is not loading data when I add the app to my home screen.

It works fine in Desktop Safari, Desktop Chrome, Safari on the iPhone & iPad but when I add the page to my Home Screen I just get the Loading graphic and nothing loads.

I have no idea how to debug something that is on the home screen.

I have tried it with JSON and JSON-P i.e type:'ajax' and type:'scripttag'

Neither like to be loaded from the home screen.




Ext.regModel('Cases', {
fields:[{
name:'companyName',
type: 'string'
}]
});

demos.ListStore = new Ext.data.Store({
model: 'Cases',
sorters: 'companyName',
getGroupString : function(record) {
return record.get('companyName')[0];
},
proxy: {
type: 'scripttag',
url: '/finjam/getipadcases',
reader: {
type:'json',
root:'Cases'
}
},
autoLoad: true
});

demos.List = new Ext.Panel ({
items: [{
width: Ext.is.Phone ? undefined : '100%',
height: Ext.is.Phone ? undefined : '100%',
xtype: 'list',
grouped: true,
indexBar: true,
onItemDisclosure: function(record, btn, index) {
Ext.Msg.alert('Tap', 'Disclose more info for ' + record.get('companyName'), Ext.emptyFn);
},
store: demos.ListStore,
itemTpl: '<div class="contact"><strong>{companyName}</strong></div>'
}]
});


My JSON


stcCallback1001({"Cases":[{"companyName":"DEMO COMP 1 LTD"},{"companyName":"DEMO COMP 2 LTD"},{"companyName":"DEMO COMPANY TWO LTD"},{"companyName":"DEMO JAMES LTD"},{"companyName":"DEMO UBUNTU LTD"}]})

cherbert
25 Aug 2011, 6:33 AM
Just a bit of an update..

I removed the autoLoad: true from the store and then added a load command after the app has initialised and it worked!

Since autoLoad:true works outside of the home screen perhaps I should leave this thread here in case anyone else thinks this is worthy of a bug report?

johnseelewis
17 Oct 2011, 5:57 AM
Could you post the code you solved the problem with? I would like to see exactly how you did it since I am trying to do something similar and I am still a bit confused when it comes to syntax. (but I'm getting better)

Thanks!

siebmanb
7 Nov 2011, 6:05 AM
I have exactly the same problem and disabling the auto-load seems to work.
Any idea if this bug is going to be fixed ?

mitchellsimoens
7 Nov 2011, 7:09 AM
Looks like this is caused by Apple's security measures... You can do remote debugging on iOS.

Here are a couple:

http://jsconsole.com/remote-debugging.html
http://www.webkit.org/blog/1620/webkit-remote-debugging/