Hi Martin and thanks for the answers, which result in more questions :)

Hi,
>
> I had a look at the data binding framework of Qooxdoo which looks great and
> promising. I have a question though, it looks like there is some support for
> pulling data out of a data source and then binding it to a view widget via
> the Json store class, then the controllers. But is the other direction
> possible, eg, detect a change to the model which was bound to a widget, and
> automatically make a server call back to the web server to update the data
> source (probably a relational DB).
>
>
> Sure that is possible. But we dont have a store ready for it yet. You can
> see an example for writing data back from the model in the gears demo in the
> demo browser. Specially for such a scenario, a bubble event mechanism has
> been introduced to the generated models. That way you dont have to listen to
> every single value in the model.
> You can take a look at the API or the code to see how it works:
> http://demo.qooxdoo.org/devel/apiviewer/#qx.data.marshal.MEventBubbling
>

I've looked at this and
MEventBubbling<http://demo.qooxdoo.org/devel/apiviewer/#qx.data.marshal.MEventBubbling>seems
the way to go. However I am not quite sur how to use it. In the Gears
demo you just create a class from some result JSON data via the marshaller
and add an option so that the generated class automatically implements this
mechanism. How can I do this with one of my own class? I can add the
MEventBubbling mixin, but the API say:

If you want to use this in your own model classes, be sure that every
property will call the
#_applyEventPropagation<http://demo.qooxdoo.org/current/apiviewer/index.html#qx.data.marshal.MEventBubbling#_applyEventPropagation>function
on every change.

How do I do this? Manually writing my own setter that will call this
function? Doesn't it defeat the purpose of having this mechanism? I mean, if
I have to write all my setters functions, I may as well make them call the
final method that will update the model back into the server via a server
call.


> <http://demo.qooxdoo.org/devel/apiviewer/#qx.data.marshal.MEventBubbling>
> Of course, such an automatic change may cause some problems, so it should
> be configurable I guess (only update when the user presses a specific button
> for instance). I guess I could also manually code something up pretty
> quickly thanks to Qooxdoo events launched on the model (writing code on
> _apply for instance), but I was wondering, has anyone thought of this
> functionality? It would be nice if it were implemented in a way which makes
> sense.
>
> Sure we have thought of that. Its on our todo list to get something in that
> direction out of the box.
>

Ok, I will wait until you are a bit more advanced on this then.

Second question, because of cross domain concerns, I am using the script
> implementation when making server calls. Is this option available when using
> the Json store? Eg, is it possible to use the current Json store with a
> server call via a script transport implementation.
>
> It is possible but not right out of the box. Just take a look at the
> twitter or flicker demo in the demobrowser. Each of them uses a special
> store implementation and a other object for transport (both use JSONP). I
> guess exactly the same way you could change the transport layer.
>

Ok, haven't looked at that yet but I will soon.


> Third question, the docs about using a delegate for data-binding don't
> mention how to actually use the delegate with the controller ?! Eg, once you
> wrote your delegate, how do you hook it up in your controller?
>
> The lists and tree controller support the delegation mechanism. Both of
> them have a property called delegate where the created delegate object
> should be set via setDelegate(...). Thats all. :)
>

Ha ok. I only looked at the simple Object controller and it did not have
that property, thus my confusion. So you cannot use a delegate with the
Object controller? Why? (I currently only use Object controllers).


> Last question, I am interested in the hierarchy data binding ("A more
> advanced feature of the single value binding is to bind a hierarchy of
> properties to a target property.")
>
> However, conceptually, with a complex model, there could be more than one
> child for the parent object.
> Eg, how would you adapt the current following code to a case where a has a
> "b" node but also a "c" node with a different property? Does not look
> possible currently...
>
> var a = new Node("a");      // set the name to „a“
> var b = new Node("a");      // set the name to „b“
> a.setChild(b);
>
>
> // bind the property to a labels content
> a.bind("child.name", label, "content");
>
>
>
> The binding always goes down from one property to another. If you change
> something in the chain, the binding tries to get down the new property
> chain. If thats not possible, the target property will be reseted.
> I did recently a presentation on the whole data binding layer. Perhaps the
> slides could make the concept of the "deep binding" better understandable.
> You can find the slides on my slideshare account.
> http://www.slideshare.net/wittemann/data-binding-in-qooxdoo
>

For this I think you did not really understand my question. Let's imagine
that we have an object myZoo of the class Zoo. Zoo has two properties lion,
and elephant.

How could I bind myZoo.lion.age to a GUI widget (like a slider), but at the
same time bind myZoo.elephant.age to another slider widget?

If I do myZoo.setChild(lion); then I guess it has no sense writing
myZoo.setChild(elephant) because I already declared a child - but myZoo in
effect has multiple children!

In the

myZoo.bind("child.age <http://child.name/>", slider, "value");

call, which child will be used?

Do you see what I mean?

Cheers

Jean-Noel
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to