Hello,

I've been trying to implement a tree for a few days, but have been unable to
figure out how to tell what nodes of a tree have been selected by a user.

I've constructed a tree in the following manner:

=================================================================
=================================================================

var testTree = new qx.ui.tree.Tree();

var testRoot = new qx.ui.tree.TreeFolder("Root");

var testRootCheckBox = new qx.ui.form.CheckBox();
                        
testRoot.addWidget(testRootCheckBox);

testRoot.addWidget(new qx.ui.core.Spacer(4, 4));

testRoot.addLabel("My Root");

testTree.setRoot(testRoot);

testRoot.setOpen(true);

testTree.setSelectionMode("multi");

var test0 = new qx.ui.tree.TreeFolder();
var test1 = new qx.ui.tree.TreeFile();
var test2 = new qx.ui.tree.TreeFile();

var test0CheckBox = new qx.ui.form.CheckBox();
var test1CheckBox = new qx.ui.form.CheckBox();
var test2CheckBox = new qx.ui.form.CheckBox();

test0.addWidget(test0CheckBox);
test1.addWidget(test1CheckBox);
test2.addWidget(test2CheckBox);                 
                        
test0.addWidget(new qx.ui.core.Spacer(4, 4));
test1.addWidget(new qx.ui.core.Spacer(4, 4));
test2.addWidget(new qx.ui.core.Spacer(4, 4));
                        
test0.addLabel("Folder");
test1.addLabel("File 1");
test2.addLabel("File 2");

test0.add(test1, test2);

testRoot.add(test0);

testTree.addListener("changeSelection", function(e)
{
        //This code is most likely
wrong//////////////////////////////////////////////////////////////////////////
        var selections = e.getData();

        for (selection in selections)
       {
              //Do something
       }
});

=================================================================
=================================================================

Any attempt at analyzing what node has been selected (via its label) or
whether a check box has been checked, has been met with a run time error
which leads to the tree freezing up (preventing the user from making any
further selections after their initial selection).

Question 1: How would I traverse the tree to see what nodes were selected?

Question 2: How would I read / output the label of each selected node?

Question 3: How would I read / output whether a check box was checked or
not?

Note: I made sure to look at various tree examples in the Demo Browser and
also searched through various forum posts regarding trees, with no luck.

Any help would be greatly appreciated.

Thank you,
Nelson



--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/How-to-tell-what-nodes-in-a-tree-have-been-selected-tp7587659.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Full-scale, agent-less Infrastructure Monitoring from a single dashboard
Integrate with 40+ ManageEngine ITSM Solutions for complete visibility
Physical-Virtual-Cloud Infrastructure monitoring from one console
Real user monitoring with APM Insights and performance trend reports 
Learn More http://pubads.g.doubleclick.net/gampad/clk?id=247754911&iu=/4140
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to