Assuming I followed the Sencha Touch 2 Getting Started tutorial and has a list populated with JsonP proxy data, how can I output cached data if the user is disconnected? Currently, the list simply does not appear if there is no Internet connection.
In the video tutorial, Ed briefly mentions that this can be “easily done,” but does not provide a link to where I can find this in the Sencha documentation.
The following is an example of my storage object:
Ext.define('test.store.NewsListStore', {
extend : 'Ext.data.Store',
requires: ['test.model.NewsListModel', 'Ext.data.Request'],
config : {
model : 'test.model.NewsListModel',
storeId : 'news-list-store',
autoLoad: true,
proxy: {
type: 'jsonp',
url : 'http://example.com/jsonp',
config : {
noCache: false
}
},
grouper : {
groupFn : function(record) {
var unix_timestamp = parseInt(record.get("entry_date"));
var date = new Date( unix_timestamp*1000 );
return Ext.Date.format(date, 'F');
}
},
}
});
source
share