How do I use Lawnchair with more than one table?

半腔热情 提交于 2019-12-10 17:25:26

问题


I am trying to use Lawnchair (http://westcoastlogic.com/lawnchair/) for a mobile project to store information about different things. I need to store in more than more table.

var people = new Lawnchair('people');

var groups = new Lawnchair('groups');

This does not completely work, it tries to copy contents from the people table to the group table. I have tried setting people.adapter.table on the fly which also results in a similar issue. I'm beginning to think it is not possible to have more than one table with Lawnchair..

Any help?


回答1:


You should set the 'name' option on your Lawnchair instances:

var people = new Lawnchair({name: "people"}, function(){});

var groups = new Lawnchair({name: "groups"}, function(){});

-Marc




回答2:


try older Lawnchair JavaScript Lawnchair library.. stored as same "table"?




回答3:


I've never used Lawnchair, but it appears to be serializing your objects to JSON which doesn't support references. You might need to convert your objects to some intermediate form (i.e. replace the "people" reference with its key. Then, after you read it, you could use the key to get the object back.




回答4:


Lawnchair is a cross mobile device key-value data store that insulates you from worrying about what platform your code is on.

You are trying to bend LawnChair in to doing something that it isn't designed to do.

You need to do full HTML5 database SQL.




回答5:


And also be noted that, use adapter as 'dom' if you have no specific adaptor, sometimes Lawnchair will use window-name adapter as default adaptor, which have some problems with multiple table scenario.



来源:https://stackoverflow.com/questions/5508634/how-do-i-use-lawnchair-with-more-than-one-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!