PDA

View Full Version : Bindstore in offline application



erwin85
15 Jun 2011, 10:41 AM
My application is using the tutorial http://www.sencha.com/learn/Tutorial:Taking_Sencha_Touch_Apps_Offline.

Now I've made a listview with data from a JSON file. Its working perfect. It load the data in the Local Storage of the browser.

Now I've another Json file I like to save in Local storage. Because I need the JSON as objects for drawing a Chart I don't use a component with a Store.
My code looks like this.


app.stores.grafiek.addListener('load', function(){
console.log("I think we are online");
app.stores.offlineGrafiek.proxy.clear();

var series = {
name:"Robeco funds", pointStart: Date.UTC(2010,1,1),
data: []
};

this.each(function (record) {
var grafiek_data = app.stores.offlineGrafiek.add(record.data)[0];
app.stores.offlineGrafiek.sync();
console.log(this);
this.data.bindStore(app.stores.offlineGrafiek);
});

In record.data you can find a object with within a date and a value.
Now I'm trying to bind this to a store: this.data.bindStore(app.stores.offlineGrafiek);
But I don't know how to to this.
In the example with my list view I did the folowing:
app.views.select_fund.items.getAt(0).bindStore(app.stores.offlinefunds);
But in the example above I've no list view with a Store. I just load the store directly.

Can someone help me?