Hello Dave,

thank you ver much for the compliments. :)

Thats something we are aware of. You can bind the selection instead.  
See the code here as an example:

// create the select box
selectBox = new qx.ui.form.SelectBox();
selectBox.add(new qx.ui.form.ListItem("a"));
selectBox.add(new qx.ui.form.ListItem("b"));
selectBox.add(new qx.ui.form.ListItem("c"));
selectBox.add(new qx.ui.form.ListItem("d"));
this.getRoot().add(selectBox);

// create the model
var data = {sel: ""};
model = qx.data.marshal.Json.createModel(data);

// selectBox to model
selectBox.bind("selection", model, "sel", {
   converter : function(data) {
     return data[0].getLabel()
   }
});


// model to selectBox
model.bind("sel", selectBox, "selection", {
   converter : function(data) {
     var selectables = selectBox.getSelectables();
     for (var i = 0; i < selectables.length; i++) {
       var item = selectables[i];
       if (item.getLabel() == data) {
         return [item];
       }
     }
     return null;
   }
});

Does that help?

Regards,
Martin



Am 24.07.2009 um 17:39 schrieb dmbaggett:

>
> I've been doing a lot with Martin's data binding framework in 0.8.3- 
> pre.
> Truly amazing stuff! Very, very nice work, Martin.
>
> One thing I've noticed, however, is that as of 0.8.3-pre, the "value"
> property of SelectBox and List are deprecated. Looking at the code,  
> I can
> see why this is -- the goal there is to standardize on the single  
> selection
> mixin -- but for binding we need a property to bind to.
>
> It works right now to bind to the "value" property, but you get  
> warnings
> about the property being deprecated. Could those warnings be  
> removed? And,
> in general, there are probably going to be other cases like this,  
> where
> you'd like to establish a bidirectional binding but cannot, because  
> the
> object in question lacks an appropriate property. It's almost like  
> we need a
> way to bind to either a property, event, *or* some arbitrary piece  
> of code
> that knows how to get/set/reset a (fake or hidden) property of the  
> target
> object.
>
> (It may be possible to do this already with delegation, but I must  
> confess I
> don't fully understand that part of the code yet.)
>
> Dave
>
> -- 
> View this message in context: 
> http://www.nabble.com/Data-Binding-to-SelectBox-and-List-tp24646821p24646821.html
> Sent from the qooxdoo-devel mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to