Hello Jean-Noel, thanks or the flowers for my last suggestion. I'll do my best. :)
Looks like you are one step ahead of me with your current problem. I have thought about binding radio buttons and a radio group but havent testet it yet. So officially it is not supported by the current data binding layer. I guess what you are looking for is something like a binding of a form. We are currently working towards such a dynamic form widget including the whole data binding. The first step was to get the form API right. So if you want to be informed of the status of the form controller, you can add yourself as cc in the bug report here: http://bugzilla.qooxdoo.org/show_bug.cgi?id=2295 But you dont have a big problem i guess. ;) I have found a workaround which might be not really an elegant way but its working. You can use the list controller and a list widget as a container for the RadioButtons from the form namespace. Just test the following code in the playground and see how it could work: var list = new qx.ui.form.List(); list.setAppearance(""); this.getRoot().add(list); var data = new qx.data.Array("a", "b", "c", "d", "e"); var radioGroup = new qx.ui.form.RadioGroup(); var controller = new qx.data.controller.List(data, list); var delegate = { createItem : function() { var item = new qx.ui.form.RadioButton(); radioGroup.add(item); return item; }, bindItem : function(controller, item, id) { controller.bindProperty(null, "label", null, item, id); } }; controller.setDelegate(delegate); You have to handle the selection of the group with the RadioGroup object itself because the selection of the controller does not work. I hope that will work for you? Best, Martin Am 15.05.2009 um 20:29 schrieb Jean-Noël Rivasseau: > Hi, > > I am sure Martin will come up with a clever solution to my > problem ;) - his last suggestions worked perfectly. > > I have not been able to make data binding work with a RadioGroup > containing radio buttons. My problem is the following: > > I have a value, that is nullable, that can take a set of predefined > values. I want it to be bound to the GUI in the form of a radio > group. My first problem is that the default qx.ui.form.RadioButton > does not allows for null values from an interface point of view (you > cannot click on a button to toggle it off). > qx.ui.toolbar.RadioButton allows that though. > > So I have set up 4 qx.ui.toolbar.RadioButton that are linked to a > qx.ui.form.RadioGroup. Now I dont know how to setup the data > binding; what value should I bind to in the widget? I tried binding > to "changeSelection" and it does not work. I get: > > target["set" + qx.lang.String.firstUp(lastProperty)] is not a function > > I tried binding to value and it works better (although I should not > use value; it is marked deprecated in the qx.ui.form.RadioGroup > API). But it's still not perfect because it does not allow nulls > (when I unselect a toggle button, I get: > > target["reset" + qx.lang.String.firstUp(lastProperty)] > > The reset function indeed is not defined for the value property in > the current qx.ui.form.RadioGroup API. > > I also tried to use qx.ui.form.RadioButton instead of > qx.ui.toolbar.RadioButton. It does not work either, eg, I dont know > to which property / event I should bind on the RadioGroup. > > So what's the proper, current, non deprecated way of doing what I > need? Or is the RadioGroup widget not yet suitable to data binding, > which would be a real problem ;) > > Thanks > > Jean-Noel > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables > unlimited royalty-free distribution of the report engine > for externally facing server and web deployment. > http://p.sf.net/sfu/businessobjects_______________________________________________ > qooxdoo-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
