Hi all,
I'm diving right now into Qooxdoo data binding; really nice 
implementation ! I've got some questions though.

I'm trying to implement a bi-directional binding between a textfield and 
some value object that has a "value" property with an associated 
"changeValue" event. So I use a qx.data.controller.Object around my 
value object and bind the textfield bi-directionally as a target :
    modelController.addTarget(textField, "value", "value", true);
So far, so good.
The problem comes from the fact that qx.ui.form.TextField doesn't allow 
for null value (only empty string, right ?), and my value object does... 
Is there any reasoning behind preventing handling textfield null value 
as empty string behind the scene, cause it seems to me a quite common 
use-case.

Anyway, I then leveraged binding options and reversOptions to add a 
"converter" that transforms null into "" and vice versa. Now the problem 
comes from the fact that the qx.ui.form.TextField value is not a real 
Qooxdoo property. It only has accessors and event. Then, at runtime it 
complains that there is no "resetValue()" method on textfield when my 
value object "value" property is null. I checked the source and the 
converter functions are not used when testing for null value and  
triggering the reset property. So the final workaround was to add a 
resetValue method (not very clean...) :
    textField["resetValue"] = function() {textField.setValue("");}

What would make sense to me is :
- support target properties that are not actual Qooxdoo properties, i.e. 
only have accessors (and even only a setter if it's a one-way binding 
?). This would imply testing for the presence of all the derived 
property methods like "resetXXX" before execution.
- use the converter functions, if any, before testing for model "null" 
property value and then triggering the "resetXXX" method.
- allow for null values in qx.ui.form.AbstractField derived classes that 
should be handled as the empty string.

Would it make sense ?

Regards,
Vincent

-- 
Vincent Vandenschrick
 Jspresso Framework
 http://www.jspresso.org


------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to