Hello guys,
I got a question concerning the qx.ui.form.SelectBox and DataBinding. I need
to bind label and value of a selectbox to an array. By now I was using the
old (deprecated) behavior and wanted to change this.
While browsing the list archive I found a somehow complicated solution (this
code is already modified to fit my needs):
//////////////////////////////////////////////////////////////
// extract the models to an separate array
var certtypeModelData = [];
var isotypes = this.data.isotypes;
for (var m in isotypes) {
certtypeModelData.push(m);
}
var certtypeModel =
qx.data.marshal.Json.createModel(certtypeModelData,true);
var certtypeController = new qx.data.controller.List(null,
certtype);
certtypeController.setLabelOptions({converter: function(value) {
return isotypes[value].types_name;
}});
certtypeController.setModel(certtypeModel);
this.debug("Selected Model: " +
certtype.getModelSelection().getItem(0));
//////////////////////////////////////////////////////////////
this.data.isotypes is an array like this:
{0:{"types_name":"label abc"},
3:{"types_name":"label def"},
24:{"types_name":"label ghi"}}
The array's index is the id from a mysql dataset, the number of results
varies from time to time. This way everything works fine, but isn't there an
easier solution for this (imho trivial) problem? When using several
selectboxes the code blows up using this method...
Thanks to everybody,
Daniel
--
View this message in context:
http://www.nabble.com/SelectBox---Databinding-tp25672831p25672831.html
Sent from the qooxdoo-devel mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel