yes, try
var list = [{name: "Kansas", id: 1},{name: "Arizona", id: 2}];
var selectBox = new qx.ui.form.SelectBox();
var model = qx.data.marshal.Json.createModel(list);
var controller = new qx.data.controller.List(model, selectBox, "name");
this.getRoot().add(selectBox);
selectBox.setModelSelection([model.getItem(1)]);
For a dynamic application check this example and thread
http://tinyurl.com/2v28sn2
http://qooxdoo.678.n2.nabble.com/SelectBox-set-selection-td4798272.html
But I just realize this alternative dont work:
var list = [{name: "Kansas", id: 1},{name: "Arizona", id: 2}];
var selectBox = new qx.ui.form.SelectBox();
var model = qx.data.marshal.Json.createModel(list);
var controller = new qx.data.controller.List(model, selectBox, "name");
this.getRoot().add(selectBox);
controller.setSelection([model.getItem(1)]);
Why dont work?
--
View this message in context:
http://qooxdoo.678.n2.nabble.com/How-to-select-an-item-in-selectbox-tp5029330p5032530.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