如何获得离线商店对象

时间:2014-01-09 12:19:17

标签: qooxdoo

我正在寻找进入离线商店对象的数据,但是在编组之后很难将简单的对象恢复。

var store = new qx.data.store.Offline("test offline");
store.setModel(qx.data.marshal.Json.createModel([{"hello":[1, 2, 3]}, {"hello again":[3, 4, 5]}]));

store.getModel().toArray().forEach(function(obj){  

  // How do I get this object back into something like obj["hello again"] -> [3, 4, 5]  
  console.log(obj); 

  /**
    console.log(obj.getHello()); // This works if I know the name, but I'm
    having the users create the name which could be complicated to piece
    back together in a getter    
  */
});

这是一个游乐场示例: http://tinyurl.com/p52pjgo

感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

您可以使用Serializer:

console.log(qx.util.Serializer.toNativeObject(store.getModel()));