Hi Martin,
you can use tree.seSelection([item]);
In your case you'll have to get that item somehow:
this.__items = [];
this.__items['te1_1'] = new qx.ui.tree.TreeFolder("Files");
then in your listener:
button.addListener("execute", function(evt) {
tree.setSelection([this.__items['te1_1']]);
}, this);
or you can use the new model property and for every item:
item.setModel("files"); //or any other value or object
and just set the selection like:
tree.setModelSelection(["files"]);
On Fri, Sep 4, 2009 at 10:08 AM, Martin_GER <[email protected]> wrote:
>
> Hi,
>
> where can I set the Selection of a Treefolder in a Tree.
> I want to click on the "test-button" and mark the "Files" line.
> Thanks!
>
> Here is my code:
>
> qx.Class.define("tree_test.Application",
> {
> extend : qx.application.Standalone,
>
> members :
> {
> main: function()
> {
> this.base(arguments);
>
> var hBox = new qx.ui.layout.HBox();
> hBox.set(
> {
> spacing: 20
> });
> var container = new qx.ui.container.Composite(hBox);
> this.getRoot().add(container);
>
> var tree = this.getTree();
> container.add(tree);
>
> var button = new qx.ui.form.Button("test-button",
> "");
> button.addListener("execute", function(evt) {
> alert("set 'Files' in Tree");;
> }, this);
> container.add(button);
> },
> getTree : function()
> {
> var tree = new qx.ui.tree.Tree().set({
> width : 200,
> height : 400
> });
>
> var root = new qx.ui.tree.TreeFolder("root");
> root.setOpen(true);
> tree.setRoot(root);
>
> var te1 = new qx.ui.tree.TreeFolder("Desktop");
> te1.setOpen(true)
> root.add(te1);
>
> var te1_1 = new qx.ui.tree.TreeFolder("Files");
> var te1_2 = new qx.ui.tree.TreeFolder("Workspace");
> var te1_3 = new qx.ui.tree.TreeFolder("Network");
> var te1_4 = new qx.ui.tree.TreeFolder("Trash");
> te1.add(te1_1, te1_2, te1_3, te1_4);
>
>
> var te1_2_1 = new qx.ui.tree.TreeFile("Windows (C:)");
> var te1_2_2 = new qx.ui.tree.TreeFile("Documents (D:)");
> te1_2.add(te1_2_1, te1_2_2);
>
> var te2 = new qx.ui.tree.TreeFolder("Inbox");
>
> var te2_1 = new qx.ui.tree.TreeFolder("Presets");
> var te2_2 = new qx.ui.tree.TreeFolder("Sent");
> var te2_3 = new qx.ui.tree.TreeFolder("Trash");
>
> for (var i=0; i<30; i++) {
> te2_3.add(new qx.ui.tree.TreeFile("Junk #" + i));
> }
>
> var te2_4 = new qx.ui.tree.TreeFolder("Data");
> var te2_5 = new qx.ui.tree.TreeFolder("Edit");
>
> te2.add(te2_1, te2_2, te2_3, te2_4, te2_5);
>
> root.add(te2);
>
> return tree;
> }
> }
> });
> --
> View this message in context:
> http://n2.nabble.com/How-can-I-set-the-Selection-of-a-TreeFolder-in-Tree-tp3579839p3579839.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel