« Return to Thread: Data Binding and Map Vars

Re: Data Binding and Map Vars

by Martin Wittemann :: Rate this Message:

Reply to Author | View in Thread

Hello Guilherme,

im not surprised that this does not work. The data binding is currently restricted to properties. We decided that because they can offer the change notifications we need for the source values of the binding. So plain javascript maps would not work as sources for the binding. But I guess you already know that because your example shows the usage of a map as target.

Implementing that functionality could be some work because there can be a couple of variants in the target property chain. See some examples here:
a.b.c.d
a[0].b
a[last]

Additionally you have no idea of how to reset such keys in a map because there is no additional information. Setting the value to null would maybe the only reasonable way to do a reset. So I don't know if we want to take that step of additional work and a increase of code size and complexity in the data binding. Perhaps you can tell me how a map would help you or why you need it? Why don't you just use the marshaler and create a qooxdoo object from that map?

Best,
Martin


Am 06.07.2009 um 22:54 schrieb Guilherme Aiolfi:

Hi Martin and others,

I was trying to use data bindings with hash maps, the native ones. Here something I tried:

--code--
var textfield = new qx.ui.form.TextField();
var obj = {};
textfield.setLiveUpdate(true);
var doc = this.getRoot();
doc.add(textfield,    {          left : 100,          top  : 50     });
doc.add(label,        {          left: 100,          top: 75        });
textfield.bind("value", obj, "textfield");
textfield.setValue("cssadas");
alert(obj["textfield"]);
--code--

That didn't work. Is there someway to use data bindings with Map vars? If so, how?

I'm asking because I created a class qx.data.Map (just to add an event to the set method), basead on qx.data.Array and with some changes in the qx.data.SingleValueBinding, the data binding in a map var worked.

It would be a great addition to qooxdoo that would increase its flexibility. And I guess it's not that hard to achieve it with the actual structure.

What do you think?
------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@...
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@...
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

 « Return to Thread: Data Binding and Map Vars