Hello Michael and welcome to qooxoo,
you are right with your guess that the mistake is in the last line of your
code and that the bind method can not access the property. The reason is
that the controller does not have such a property. The property is on the
model. To get that working, you have two options:
1. Without the controller
dtaStore.bind("model.persons[0].lastname", lblName, "value");
2. With the controller
dtaController.addTarget(lblName, "value", "[0].lastname");
Both ways work as expected. I would prefer the first option if its such a
sing point connection.
If you plan to use more of the data binding, perhaps the cheat sheet might
help you:
http://qooxdoo.org/documentation/1.0/data_binding#demos_api_and_cheatsheet
Best,
Martin
Michael Schwarzl wrote:
>
> Hello,
>
> I'm new to qooxdoo. At first: this is an amazing framework!
>
> Now to my question: I try to bind a JSON data store (f.e. persons.json) to
> some labels. According to the JsonToList example I created a Controller
> and a Store and try to bind the data but I won't work:
>
> Here is my playground example:
>
> var doc = this.getRoot();
>
> var lblName = new qx.ui.basic.Label("test").set({rich: true});
> doc.add(lblName, {left:10, top:10});
>
> var url =
> "http://demo.qooxdoo.org/current/demobrowser/demo/data/json/persons.json";
> var dtaController = new qx.data.controller.Object();
> var dtaStore = new qx.data.store.Json(url);
> dtaStore.bind("model.persons", dtaController, "model");
> dtaController.bind("persons[0].lastname", lblName, "value");
>
>
>
> It seems that the bind method cannot access the property
> "persons[0].lastname".
> How do I correctly bind data in my case?
>
> Thanks,
> Michael
>
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and
> easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
--
View this message in context:
http://n2.nabble.com/Binding-Data-from-a-JSON-store-to-simple-labels-tp4249535p4249904.html
Sent from the qooxdoo mailing list archive at Nabble.com.
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel