Good Morning Michael, If the data binding can determinate the model used for the conversion, there is a second parameter in the converter containing the corresponding model. But this only works using the list or tree controller. Take a look at the NamesList demo in the qooxdoo demobrowser: http://demo.qooxdoo.org/current/demobrowser/#data~NamesList.html This demo shows exactly what you are looking for. But keep in min that the binding only updates if the original property will be changed. All changes of the values used for the calculation wont be recognized. If you need to have that behavior, you need to set up a second binding to the same target.
Sure, every model is a plain qooxdoo object and can be accessed vie the default getter and setter. The only exception are arrays. We can't use native arrays for bindings because we have no chance to detect changes on native arrays. Thats why we have to use special arrays: qx.data.Array. The problem with creating a own array are the default accessor and mutator methods. You can't use array[i] with the data array of qooxdoo unfortunately. You have to use getItem(i) to read and setItem(i, value) to set a value. If you are interessted in debugging your models, take a look at the debuggung demo: http://demo.qooxdoo.org/current/demobrowser/#data~ModelDebugging.html It shows you the usage of qx.dev.Debug.debugProperties which is quite handy to take a look at your models. Regards, Martin Michael Schwarzl wrote: > > Hello Martin, > > thank you for your welcome and answer! Your suggestion (I now use the > store without a controller) works perfect. I have another two questions: > >> Is it possible to perform calculations of several store.model fields? For >> example to calculate "lastname + ' ' + firstname" via a converter: > {converter: function(data) { return ... any calculated value ...; > }} > The data parameter contains the single value of the bound property. > >> Are the properties which are bound via .bind("model.persons[0].firstname" >> accessible directly? Like "dtaStore.getModel().Persons[0].lastname" ? > > Thanks! > > Best regards, > Michael > > > Am 04.01.2010 14:41, schrieb MartinWittemann: >> >> 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 >>> >>> >> > > > > ------------------------------------------------------------------------------ > 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-tp4249535p4254070.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
