PDA

View Full Version : Offline App + Ajax Carousel



lewisc
12 Jul 2011, 10:52 AM
Hi everyone

I've implemented the AJAX carousel from the example2 in the download. It's working brilliantly, only problem is if I take my app offline, the whole app works fine but doesn't load the carousel.

The xml file I'm using for my data is being cached fine but it isn't loading.

Please help me out :)

lewisc
13 Jul 2011, 9:53 AM
I've included my code


Ext.regModel('Features', {
fields: ['id', 'issueno', 'date', 'topic', 'title', 'tagline', 'text']
});

var store = new Ext.data.Store({
model: 'Features',
proxy: {
type: 'ajax',
url: 'features.xml',
reader: {
type: 'xml',
record: 'feature'
}
},
listeners: {
single: true,
datachanged: function(){
var items = [];
store.each(function(rec){
items.push({
html: '<div id="todayband">iPad Edition</div><div id="todaymasthead"><div class="logo"><img src="img/headline.png" width="484" height="50" /></div><div class="issue">ISSUE NO. ' + rec.get('issueno') + '</div><div class="date">' + rec.get('date') + '</div></div><div id="mghead"><div class="title"><h1>' + rec.get('title') + '</h1></div><div class="topic">' + rec.get('topic') + '</div></div><div id="magazinelayout"><h2>' + rec.get('tagline') + '</h2><p>' + rec.get('text') + '</p></div><center><div id="ad_720"><img src="img/ads/ad_720x90.png"></div></center>'
});
});

var carousel = new Ext.Carousel({
items: items,
itemId: 'carousel'
});

panel.add(carousel);
panel.doLayout();

}
}
});

store.read();


This works fine when it's online, but as soon as it goes offline it no longer loads.

digeridoo
5 Dec 2011, 3:06 PM
Strange, I'm doing something similar to you but using a php file to grab images to store in a store...and that works offline. Might it have something to do with XML? I don't see why it would...

Good way to check would be to right click on the HTML and inspect...have a look at the console for any errors. What does it say?