2014-01-09 3 views
0

오프라인 저장소 개체로 들어온 데이터를 검색하려고하지만 마샬링 후에 단순 개체를 다시 가져 오는 것은 어렵습니다. 도움을 http://tinyurl.com/p52pjgo오프라인 저장소 개체를 가져 오는 방법

감사 :

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  
    */ 
}); 

여기 놀이터 예입니다!

답변

1

당신은 그것을 위해 시리얼 라이저를 사용할 수 있습니다

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

+1

멋진! 감사! 뭔가가 있어야한다는 것을 알았습니다. 아직 찾지 못했습니다. :-) – Jonathan

관련 문제