1

I have been playing around with using Lawnchair in phonegap but can only get the data to load on the same page it was saved.

Is this how Lawnchair works?

I have tried console.log to log the data that I have saved using Lawnchair on the page that it was saved in, but as soon as I move to another page with the same retrieval code it does not show.

Aaron Fisher
  • 645
  • 3
  • 8
  • 23

2 Answers2

3

I had a similiar problem when building a two-page HTML5 'app' based on Local Storage.

I made the mistake of not including the 'dom' plugin alongside the lawnchair.js file. (I thought it was somehow already built-in to Lawnchair because its the default storage system).

See the first paragraph of this post..

Ivan Ferić
  • 4,725
  • 11
  • 37
  • 47
  • Thank you, this helped a lot. I got it narrowed down to this and another bug that was caused from using something different in jQuery Mobile. – Aaron Fisher Feb 27 '13 at 21:16
2

Here is an example:

var res = Lawnchair({name:'key',adapter:'dom'},function(e){
});

res.all(function(data){
    for(var i = 0; i<data.length;i++)
    {
      Get data using data[i].value.fieldname.....
    }
  });
});
  • Thank you for the response, it ended up being a bug from using jQuery mobile and with the DOM plugin with Lawnchair. I created a new dummy application and it worked first time. But again, thank you for the response, the loop may actually help me with something else. – Aaron Fisher Feb 27 '13 at 21:14