:-D true.
now it works the way that I expected.
my code changes below for everyone who's interested
(including comments)
Thank you very much!
MartinWittemann wrote:
>
> [...] have you thought of using the selection of the controller? [...]
/**
* @author phill54
*/
qx.Class.define("jsonTreeTest.TreeModelTest",
{
extend : qx.core.Object,
construct : function () {
var tree = new qx.ui.tree.Tree().set({
selectionMode : "one",
hideRoot : false,
rootOpenClose : true,
width: 400,
height: 300
});
var controller = new qx.data.controller.Tree(null, tree,
"kids", "name");
controller.setIconPath("iconpath");
var url = "http://phill54/datasource/tree.json.php";
var store = new qx.data.store.Json(url);
store.bind("model", controller, "model");
controller.bind("model", store, "model");
/* now the event is bound to the controller, not the tree */
controller.addListener("changeSelection", function(ev) {
var data = ev.getData();
console.log(data.classname); // event data is an array
console.log(data.length); // array length complies to
the selection
console.log(data.getItem(0)); // first item of selection
}, this);
store.addListener("loaded", function(ev) {
tree.getRoot().setOpen(true);
}, this);
qx.core.Init.getApplication().getRoot().add(tree, {top: 10,
left: 10});
},
destruct : function () {
},
properties : {
},
members : {
}
});
--
View this message in context:
http://n2.nabble.com/Json-Store-Tree-Controller-changeSelection-event-gets-fired-three-times-per-click-tp4107059p4111142.html
Sent from the qooxdoo mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel