Hi Khoa Tran,
can you send me more information about what is happening ?
An error message for example will be great.
Thanks,
Romeo
Von: Đăng Khoa Trần Quang [mailto:[email protected]]
Gesendet: Freitag, 29. März 2013 13:29
An: qooxdoo Development
Betreff: [qooxdoo-devel] Problem with JSON Object of Tree Virtual
Hi Qooxdoo team,
I have used the TreeVirtual for my application and transform the structure of
treevirtual to json object for storing in database. But i have a problem with
loading the TreeVirtual which is modified (deleted a node or a branch). Here is
the code snipet
var dataModel = TreeVirtual.getDataModel();
var dataRows = dataModel.getData();
//If the current VirtualTree was modified (delete nodes or branches) I will
eliminate it.
var Nodes = new Array;
for(var i = 0; i < dataRows.length; i++){
var node = dataRows[i];
if(node != null){
Nodes.push(node);
}
}
//the data of TreeVirtual is transformed to JSon structure before saving to
database
var JsonObject = qx.util.Serializer.toJson(dataRows);
When loading from the database, I have used the function below
var jsonObject = /* get from database */
var dataModel = TreeVirtual.getDataModel();
dataModel.setData(qx.lang.Json.parse(jsonObject ));
1. Loading a tree which has not been modified - successful
2. Loading a tree which has been modified - unsuccessful.
3. This is the JSON object of TreeVirtual which has been modified
[
{"nodeId":0,"children":[6],"label":"<virtual root>","bOpened":true},
{"columnData":[null,null],"icon":null,"parentNodeId":0,"bHideOpenClose":null,"bSelected":false,"qid":1000002,"qName":"Subnet(V4)","children":[7],"label":"Subnet(V4)","type":2,"lastChild":[true],"bOpened":true,"nodeId":6,"qType":"sub_option","level":1,"iconSelected":null,"bFirstChild":true},
{"columnData":[null,null],"icon":null,"parentNodeId":6,"bHideOpenClose":null,"bSelected":false,"children":[8,9,10],"label":"And","type":2,"lastChild":[true,true],"bOpened":true,"nodeId":7,"level":2,"iconSelected":null,"bFirstChild":true},
{"columnData":[null,null],"icon":"qip/icons/text-plain.png","parentNodeId":7,"bHideOpenClose":false,"bSelected":false,"children":[],"qName":"Address","label":"Subnet(V4)
-
Address","type":1,"lastChild":[true,true,false],"bOpened":false,"nodeId":8,"qType":"ip_address","qpid":1000002,"level":3,"iconSelected":"qip/icons/text-plain.png","bFirstChild":true},
{"columnData":[null,null],"icon":"qip/icons/text-plain.png","parentNodeId":7,"bHideOpenClose":false,"bSelected":false,"children":[],"qName":"Comments","label":"Subnet(V4)
-
Comments","type":1,"lastChild":[true,true,false],"bOpened":false,"nodeId":9,"qType":"text","qpid":1000002,"level":3,"iconSelected":"qip/icons/text-plain.png","bFirstChild":false},
{"columnData":[null,null],"icon":"qip/icons/text-plain.png","parentNodeId":7,"bHideOpenClose":false,"bSelected":false,"children":[],"qName":"UDA","label":"Subnet(V4)
-
UDA","type":1,"lastChild":[true,true,true],"bOpened":false,"nodeId":10,"qType":"uda_list","qpid":1000002,"level":3,"iconSelected":"qip/icons/text-plain.png","bFirstChild":false}
]
Would you please give me some advices about it ? I really appriciate for your
help.
Thanks
Khoa Tran
------------------------------------------------------------------------------
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete
for recognition, cash, and the chance to get your game on Steam.
$5K grand prize plus 10 genre and skill prizes. Submit your demo
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel