This seems basic, but can’t seem to find a way to implement this: I would like to initialize a SelectBox from an array
var array = ["item1","item2"...]
instead of having to loop through ListItems
var selectBox = new qx.ui.form.SelectBox();
var test = ["item1", "item2"];
for (var i = 0; i < test.length; i++){
var tempItem = new qx.ui.form.ListItem(test[i]);
selectBox.add(tempItem);
}
Is there a way to do that in Qooxdoo?
First off a more elegant version of your loop:
But you should take a look at the data binding documentation in Qooxdoo (Link to documentation). When using this you have a solution like this:
When working with controllers you get some more interesting features like easy binding a change event to other widgets etc.