OK, I've been pulling my hair out for about 6 hours now, done multiple google
and forum searches and I'm still stuck so I'm posting here!
I have a tree that loads its data from a JSON file:
var url = "json/test.json";
var controller = new qx.data.controller.Tree(null, tree,
"kids", "name");
controller.setDelegate(this);
var req = new qx.io.remote.Request(url, "GET",
"application/json");
req.setTimeout(2400000);
req.addListener("completed", function(e) {
var data = e.getContent();
var model = qx.data.marshal.Json.createModel(data);
controller.setModel(model);
tree.getRoot().setOpen(true);
});
req.send();
Now this works great. What I'm trying to do next is when a user
double-clicks a particular folder, it loads more data from another JSON file
(this next code is in the function called when a folder is double-clicked):
var url = "json/test2.json";
var req = new qx.io.remote.Request(url, "GET",
"application/json");
req.setTimeout(2400000);
req.addListener("completed", function(e) {
var data = e.getContent();
currentModel = controller.getModel();
currentModel.get("kids").push(qx.data.marshal.Json.createModel(data,
true));
}, this);
req.send();
Now this works and loads the new data into the root folder, but I want to
load it into the folder that was double-clicked.
I cannot work out HOW! I've tried:
curSelect = controller.getSelection();
curSelect.push(qx.data.marshal.Json.createModel(data,
true));
And many other different variations without success.
Could someone please help point me in the correct direction?
Many thanks!
--
View this message in context:
http://qooxdoo.678.n2.nabble.com/Adding-Tree-Items-To-A-Tree-Child-Item-Using-Dynamic-Data-tp5014665p5014665.html
Sent from the qooxdoo mailing list archive at Nabble.com.
------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel