Hey,
Hello, I'm working with a "local" Offline store (qx.data.store.Offline). My
understanding of the local store (as compared to the session store) is that the
items in the store are persisted and reloaded with each new session. My local
store is working properly within a given session but the store, though
reloading a model, appears to be empty with each new session - (in chrome 36).
Below are code snippets for how it is being created and used. What could be
going wrong??
var store = new qx.data.store.Offline(key, "local");
if(this.getModel()==null){
var model = qx.data.marshal.Json.createModel({}, true);
this.setModel(model);
}
//setting values:
store.getModel()[key] = value;
//accessing values
var value = store.getModel()[key];
Accessing and setting the values is the problem. The offline store is based on
data models which are unfortunately not plain objects (thats not possible at
the moment because we need to mirror the setting of values). So you need to
define the keys before you create the model and then use property methods
(setter and getter). Instead of giving the offline store constructor a empty
object, you can add the properties there and the getter will be created for you.
On the other hand, is you simply want to have a key value store without the
data binding, I would suggest to take a look at the class qx.bom.Storage [1]
which would handle that for you in amore suitable way.
Regards,
Martin
[1] http://demo.qooxdoo.org/current/apiviewer/#qx.bom.Storage
------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel