H<http://demo.qooxdoo.org/devel/playground/#%7B%22code%22%3A%20%22var%2520tree%2520%253D%2520new%2520qx.ui.tree.Tree()%253B%250A%250Avar%2520doc%2520%253D%2520this.getRoot()%253B%250A%250A%250Adoc.add(tree%252C%250A%257B%250A%2520%2520left%2520%253A%2520100%252C%250A%2520%2520top%2520%2520%253A%252050%250A%257D)%253B%250A%250A%250Aqx.Class.define(%2522qx.model.Category%2522%252C%250A%257B%250A%2520%2520extend%253A%2520qx.core.Object%252C%250A%2520%2520construct%253A%2520function(title)%250A%2520%2520%257B%250A%2520%2520%2520%2520this.base(arguments)%253B%250A%2520%2520%2520%2520this.setChildren(new%2520qx.data.Array())%253B%250A%2520%2520%2520%2520this.setTitle(title)%253B%250A%2520%2520%2520%2520%250A%2520%2520%257D%252C%250A%2520%2520properties%253A%250A%2520%2520%257B%250A%2520%2520%2520%2520children%253A%250A%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520check%253A%2520%2522qx.data.Array%2522%252C%250A%2520%2520%2520%2520%2520%2520event%253A%2520%2522changeChildren%2522%250A%2520%2520%2520%2520%257D%252C%250A%2520%2520%2520%2520title%253A%250A%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520check%253A%2520%2522String%2522%252C%250A%2520%2520%2520%2520%2520%2520event%253A%2520%2522changeTitle%2522%250A%2520%2520%2520%2520%257D%252C%250A%2520%2520%2520%2520selected%253A%2520%250A%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520check%253A%2520%2522Boolean%2522%252C%250A%2520%2520%2520%2520%2520%2520event%253A%2520%2522changeSelected%2522%250A%2520%2520%2520%2520%257D%252C%250A%2520%2520%2520%2520open%253A%2520%250A%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520check%253A%2520%2522Boolean%2522%252C%250A%2520%2520%2520%2520%2520%2520event%253A%2520%2522changeOpen%2522%250A%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%250A%2520%2520%257D%250A%257D)%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%250Avar%2520root%2520%253D%2520new%2520qx.model.Category(%2522root%2522)%253B%250Avar%2520child%2520%253D%2520new%2520qx.model.Category(%2522child%2522)%253B%250Aroot.getChildren().push(child)%253B%250Aroot.setOpen(true)%253B%250Avar%2520treeController%2520%253D%2520new%2520qx.data.controller.Tree(root%252C%2520tree%252C%2520%2522children%2522%252C%2520%2522title%2522)%253B%250A%250AtreeController.getSelection().push(child)%253B%250A%250Atree.getRoot().setOpen(true)%253B%250A%22%7D> i,
please take a look at this code: http://demo.qooxdoo.org/devel/playground/#%7B%22code%22%3A%20%22var%2520tree%2520%253D%2520new%2520qx.ui.tree.Tree()%253B%250A%250Avar%2520doc%2520%253D%2520this.getRoot()%253B%250A%250A%250Adoc.add(tree%252C%250A%257B%250A%2520%2520left%2520%253A%2520100%252C%250A%2520%2520top%2520%2520%253A%252050%250A%257D)%253B%250A%250A%250Aqx.Class.define(%2522qx.model.Category%2522%252C%250A%257B%250A%2520%2520extend%253A%2520qx.core.Object%252C%250A%2520%2520construct%253A%2520function(title)%250A%2520%2520%257B%250A%2520%2520%2520%2520this.base(arguments)%253B%250A%2520%2520%2520%2520this.setChildren(new%2520qx.data.Array())%253B%250A%2520%2520%2520%2520this.setTitle(title)%253B%250A%2520%2520%2520%2520%250A%2520%2520%257D%252C%250A%2520%2520properties%253A%250A%2520%2520%257B%250A%2520%2520%2520%2520children%253A%250A%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520check%253A%2520%2522qx.data.Array%2522%252C%250A%2520%2520%2520%2520%2520%2520event%253A%2520%2522changeChildren%2522%250A%2520%2520%2520%2520%257D%252C%250A%2520%2520%2520%2520title%253A%250A%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520check%253A%2520%2522String%2522%252C%250A%2520%2520%2520%2520%2520%2520event%253A%2520%2522changeTitle%2522%250A%2520%2520%2520%2520%257D%252C%250A%2520%2520%2520%2520selected%253A%2520%250A%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520check%253A%2520%2522Boolean%2522%252C%250A%2520%2520%2520%2520%2520%2520event%253A%2520%2522changeSelected%2522%252C%250A%2520%2520%2520%2520%2520%2520init%253A%2520false%250A%2520%2520%2520%2520%257D%252C%250A%2520%2520%2520%2520open%253A%2520%250A%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520check%253A%2520%2522Boolean%2522%252C%250A%2520%2520%2520%2520%2520%2520event%253A%2520%2522changeOpen%2522%252C%250A%2520%2520%2520%2520%2520%2520init%253A%2520false%250A%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%250A%2520%2520%257D%250A%257D)%253B%250A%2520%2520%2520%2520%2520%250A%250Atree.setSelectionMode('multi')%253B%250Avar%2520root%2520%253D%2520new%2520qx.model.Category(%2522root%2522)%253B%250Avar%2520child%2520%253D%2520new%2520qx.model.Category(%2522child%2522)%253B%250Aroot.getChildren().push(child)%253B%250Aroot.setOpen(true)%253B%250A%250Achild.setSelected(true)%253B%250A%250A%250A%250A%2520%2520%2520%2520%2520%2520%250A%250Avar%2520treeController%2520%253D%2520new%2520qx.data.controller.Tree(null%252C%2520tree%252C%2520%2522children%2522%252C%2520%2522title%2522)%253B%250A%250A%2520%2520var%2520delegate%2520%253D%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520bindItem%2520%253A%2520function(controller%252C%2520item%252C%2520id)%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520controller.bindDefaultProperties(item%252C%2520id)%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520controller.bindProperty(%2522open%2522%252C%2520%2522open%2522%252C%2520null%252C%2520item%252C%2520id)%253B%250A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520id.bind(%2522selected%2522%252C%2520controller%252C%2520%2522selection%2522%252C%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520converter%253A%2520function()%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520return%2520controller.getSelection()%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257D%252C%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520onUpdate%2520%253A%2520function%2520(a%252C%2520b)%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520(a.isSelected())%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520controller.getSelection().push(a)%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520else%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520controller.getSelection().remove(a)%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257D)%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520(id.isSelected())%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520controller.getSelection().push(id)%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%257D%253B%250A%250AtreeController.setDelegate(delegate)%253B%250A%250AtreeController.setModel(root)%253B%250A%250A%250Aroot.setSelected(true)%253B%250Achild.setSelected(false)%253B%250A%250A%22%7D If all the child.setSelected(true or false) and root.setSelected(true or false) calls are done only AFTER the creation of the tree controller, everything goes FINE. BUT, if there is a node.setSelected BEFORE the creation of the tree controller, then the binding for that node is WRONG. The code above shows the wrong state of the selection, because of this line: root.setOpen(true); child.setSelected(true); // <--------------------------------- removing that line the code works as expected. Is that a bug in the tree controller or what? by the way, there is another better way to do what I'm trying to do with that code? Which is: every time a node is set to "selected" it is included in the tree selection.
------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel