THANK YOU SO MUCH!!! That work’s like a dream.

 

Cheers!

 

From: Krycek [via qooxdoo]
[mailto:[email protected]] 
Sent: 06 May 2010 17:47
To: coolbloke1324
Subject: Re: Adding Tree Items To A Tree Child Item Using Dynamic Data

 

Have you tried this:

 

req.addListener("completed", function(e) {
                       var data = e.getContent();

                       currentModel =
controller.getSelection().getItem(0);
                      Â
currentModel.get("kids").push(qx.data.marshal.Json.createModel(data,
true));
               }, this);

On Thu, May 6, 2010 at 12:02 PM, coolbloke1324 <[hidden email]> wrote:


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-Usin
g-Dynamic-Data-tp5014665p5014665.html
Sent from the qooxdoo mailing list archive at Nabble.com.

----------------------------------------------------------------------------
--
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

 


----------------------------------------------------------------------------
-- 

_______________________________________________ 
qooxdoo-devel mailing list 
[hidden email] 
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel



  _____  

View message @
http://qooxdoo.678.n2.nabble.com/Adding-Tree-Items-To-A-Tree-Child-Item-Usin
g-Dynamic-Data-tp5014665p5015217.html 
To unsubscribe from Adding Tree Items To A Tree Child Item Using Dynamic
Data, click
< (link removed) 
vbUBhYmJleWxhbi5jby51a3w1MDE0NjY1fDEzNDQ0NjI0NA==>  here. 

 


-- 
View this message in context: 
http://qooxdoo.678.n2.nabble.com/Adding-Tree-Items-To-A-Tree-Child-Item-Using-Dynamic-Data-tp5014665p5015505.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

Reply via email to