I guess my real question is - When the form model is updated - how does the form know which list item model to choose for it's selection? It works automatically for primitive types (strings, int) but I'm a little confused using objects.
I was a after a way to automate the selection via bindings when a) the form model is updated or even replaced (EG see the example for the "new form model" button) b) the list model is replaced (EG the example for "new list model" button) Each item in the list model is a qx object - I want to specify a property in that object (id) that can be used as the identity - otherwise how does the form binding know which item in the selection should be chosen? The form model property used for the selectBox (person) is also a qx object and also has a id property. A bit of context on what I'm trying to achieve... I have an array of objects used for the SelectBox list. This comes from the server via a json store. I have another list of records - a user can choose to edit one of these records. When the edit action is chosen the form is populated by setting the form model based on the selection. All the fields of the form model update except for the SelectBox and I'm guessing it's because the form binding does not know how to choose the appropriate item in the list. I'm not sure if the tinyurl works so I've provided the full url below.. you'll need to copy and past the whole thing. http://demo.qooxdoo.org/current/playground/#%7B%22code%22%3A%20%22%2520%2520var%2520data%252C%2520i%253B%250A%2520%2520var%2520list_data%2520%253D%2520%255B%255D%253B%250A%250A%2520%2520for%2520(i%253D0%253B%2520i%253C5%253B%2520i%252B%252B)%250A%2520%2520%257B%250A%2520%2520%2520%2520data%2520%253D%250A%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520id%2520%2520%2520%2520%2520%2520%2520%2520%253A%2520i%252C%250A%2520%2520%2520%2520%2520%2520firstname%2520%253A%2520%2522test%2520name%2520%2522%2520%252B%2520i%252C%250A%2520%2520%2520%2520%2520%2520lastname%2520%2520%253A%2520%2522test%2520last%2520%2522%2520%252B%2520i%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520%257D%253B%250A%2520%2520%2520%2520list_data.push(data)%253B%250A%2520%2520%257D%250A%2520%2520var%2520list_model%2520%253D%2520qx.data.marshal.Json.createModel(list_data)%253B%250A%250A%2520%2520var%2520form_data%2520%253D%250A%2520%2520%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520field1%2520%253A%2520%2522Field%2520One%2522%252C%250A%2520%2520%2520%2520%2520%2520%2520%2520field2%2520%253A%2520%2522Field%2520Two%2522%252C%250A%2520%2520%2520%2520%2520%2520%2520%2520person%2520%253A%2520%257B%2520id%2520%253A%25201%2520%257D%250A%2520%2520%2520%2520%2520%2520%257D%253B%250A%250A%2520%2520var%2520form_model%2520%253D%2520qx.data.marshal.Json.createModel(form_data)%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520var%2520form%2520%253D%2520new%2520qx.ui.form.Form()%253B%250A%250A%2520%2520var%2520field1%2520%253D%2520new%2520qx.ui.form.TextField()%253B%250A%2520%2520form.add(field1%252C%2520%2522Field%25201%2522)%253B%250A%250A%2520%2520var%2520field2%2520%253D%2520new%2520qx.ui.form.TextField()%253B%250A%2520%2520form.add(field2%252C%2520%2522Field%25202%2522)%253B%250A%250A%2520%2520var%2520person%2520%253D%2520new%2520qx.ui.form.SelectBox()%253B%250A%2520%2520var%2520list_controller%2520%253D%2520new%2520qx.data.controller.List(list_model%252C%2520person%252C%2520%2522firstname%2522)%253B%250A%2520%2520form.add(person%252C%2520%2522Person%2522)%253B%250A%250A%2520%2520this.getRoot().add(new%2520qx.ui.form.renderer.Single(form)%252C%2520%257Bleft%253A%252030%252C%2520top%253A%252020%257D)%253B%250A%250A%2520%2520var%2520form_controller%2520%253D%2520new%2520qx.data.controller.Form(form_model%252C%2520form)%253B%250A%250A%2520%2520var%2520button1%2520%253D%2520new%2520qx.ui.form.Button(%2522Show%2520Form%2520Model%2522)%253B%250A%2520%2520this.getRoot().add(button1%252C%2520%257Bleft%253A%2520240%252C%2520top%253A%252020%257D)%253B%250A%2520%2520button1.addListener(%2522execute%2522%252C%2520function()%250A%2520%2520%257B%250A%2520%2520%2520%2520this.debug(qx.dev.Debug.debugProperties(form_model))%253B%250A%2520%2520%257D%252C%250A%2520%2520this)%253B%250A%250A%2520%2520var%2520button2%2520%253D%2520new%2520qx.ui.form.Button(%2522Show%2520List%2520Model%2522)%253B%250A%2520%2520this.getRoot().add(button2%252C%2520%257Bleft%253A%2520240%252C%2520top%253A%252060%257D)%253B%250A%2520%2520button2.addListener(%2522execute%2522%252C%2520function()%250A%2520%2520%257B%250A%2520%2520%2520%2520this.debug(qx.dev.Debug.debugProperties(list_model))%253B%250A%2520%2520%257D%252C%250A%2520%2520this)%253B%2520%2520%2520%2520%2520%2520%250A%250A%2520%2520var%2520button3%2520%253D%2520new%2520qx.ui.form.Button(%2522New%2520Form%2520Model%2522)%253B%250A%2520%2520this.getRoot().add(button3%252C%2520%257Bleft%253A%2520240%252C%2520top%253A%2520100%257D)%253B%250A%2520%2520button3.addListener(%2522execute%2522%252C%2520function()%250A%2520%2520%257B%250A%250A%2520%2520%2520%2520form_data%2520%253D%250A%2520%2520%2520%2520%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520field1%2520%253A%2520%2522New%2520Field%2520One%2522%252C%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520field2%2520%253A%2520%2522New%2520Field%2520Two%2522%252C%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520person%2520%253A%2520%257B%2520%2520id%2520%253A%2520%25202%2520%257D%250A%2520%2520%2520%2520%2520%2520%2520%2520%257D%253B%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520form_model%2520%253D%2520qx.data.marshal.Json.createModel(form_data)%253B%250A%2520%2520%2520%2520form_controller.setModel(form_model)%253B%250A%2520%2520%2520%2520this.debug(qx.dev.Debug.debugProperties(form_model))%253B%250A%2520%2520%257D%252C%250A%2520%2520this)%253B%250A%250A%2520%2520var%2520button4%2520%253D%2520new%2520qx.ui.form.Button(%2522New%2520List%2520Model%2522)%253B%250A%2520%2520this.getRoot().add(button4%252C%2520%257Bleft%253A%2520240%252C%2520top%253A%2520140%257D)%253B%250A%2520%2520button4.addListener(%2522execute%2522%252C%2520function()%250A%2520%2520%257B%250A%2520%2520%2520%2520list_data%2520%253D%2520%255B%255D%253B%250A%2520%2520%2520%2520for%2520(i%253D0%253B%2520i%253C5%253B%2520i%252B%252B)%250A%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520data%2520%253D%250A%2520%2520%2520%2520%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520id%2520%2520%2520%2520%2520%2520%2520%2520%253A%2520i%252C%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520firstname%2520%253A%2520%2522new%2520test%2520name%2520%2522%2520%252B%2520i%252C%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520lastname%2520%2520%253A%2520%2522new%2520test%2520last%2520%2522%2520%252B%2520i%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%257D%253B%250A%2520%2520%2520%2520%2520%2520list_data.push(data)%253B%250A%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520list_model%2520%253D%2520qx.data.marshal.Json.createModel(list_data)%253B%250A%2520%2520%2520%2520list_controller.setModel(list_model)%253B%250A%2520%2520%2520%2520this.debug(qx.dev.Debug.debugProperties(list_model))%253B%250A%2520%2520%257D%252C%250A%2520%2520this)%253B%2520%2520%2520%2520%2520%2520%250A%250A%22%7D -- View this message in context: http://qooxdoo.678.n2.nabble.com/Form-Binding-with-List-Binding-tp5121281p5123570.html Sent from the qooxdoo mailing list archive at Nabble.com. ------------------------------------------------------------------------------ _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
