PDA

View Full Version : Issue with checking for Store Load - works in browser, not in iOS simulator



slowmotiongenius
28 Feb 2012, 9:07 AM
If I try to check if my store has loaded using the following code


var storeXML = FirstApp.stores.stores;
storeXML.on('load',function(store,records,options){

I have success in Safari, but it fails if I run with XCODE and the iOS/iPad simulator. It's just ignoring or not entering the on load function. Has anyone else experienced this?

Anyone have any ideas why?


FYI - I had
FirstApp.stores.stores.on('load' but wanted to be sure of things, so I set it to storeXML first to aid in some debugging and left it for this example.

mitchellsimoens
28 Feb 2012, 9:21 AM
Is the store autoLoad : true?

slowmotiongenius
28 Feb 2012, 9:41 AM
It's not set, so it's false by default.

mitchellsimoens
28 Feb 2012, 9:48 AM
do you load it after the listener is placed then?

slowmotiongenius
28 Feb 2012, 10:47 AM
It appears to me that I do



FirstApp.stores.stores.on('load',function(store,records,options){
carousel.add(items);
carousel.doLayout();
});//close on load
FirstApp.stores.stores.read();

slowmotiongenius
2 Mar 2012, 11:03 AM
If I'm developing a MVC application, where should the store.on('load' listener be placed?

In the store itself in the stores/stores.js file? Or do you listen for the load to complete elsewhere?

I'm still trying to make sense as to why this will work in a browser, but not in iOS simulator...

I'm sure there's something I'm not understanding here.

slowmotiongenius
6 Mar 2012, 8:28 AM
I've seen the store.on load listener placed in app.js and also in your controller. I tried both, and it works well in my browser, but still doesn't work in the iOS simulator.

In my store, for the URL I've tried url: './app/data.xml" as well as url: 'https://myserver.com/app/data.xml' both are working in the browser, neither in iOS simulator.