I have searched through the posts and docs but still not sure how to do this.
Basically can you automatically set the selected value of the selectbox
based on id of the selectbox and the corresponding value in model of the
form when you bind the form. Textboxes get values automatically set by
matching id to form model property, do I have to do this manually with
selectboxes?
Scenario
Form with two text fields firtsName,lastName and a select box ContactType
remote json data via rest bound to the form
json {firstName: "dan", lastName: "green",
ContactType:{__KEY:3}
}
Then I use a store to bind formController model
var formController = new qx.data.controller.Form(null,form);
store.bind("model", formController , "model");
The selectbox has hardcoded data for testing but would in reality be pulled
from remote json
var rawData = [
{name: "Home", __KEY: 1},
{name: "Work", __KEY: 2},
{name: "Household", __KEY: 3},
]
//create selectbox model
var model = qx.data.marshal.Json.createModel(rawData);
//create selectbox controller
var gender = new qx.ui.form.SelectBox();
var genderController = new qx.data.controller.List(null, gender);
genderController.setDelegate({bindItem: function(controller, item,
index) {
controller.bindProperty("name", "label", null, item, index);
controller.bindProperty("__KEY", "model", null, item, index);
}});
genderController.setModel(model);
form.add(gender, "ContactType")
The problem is when I load the from data via the formController
firstName,lastName is filled in correctly but the SelectBox selected value
is not automatically set to the value of ContactType for the forms model.
Do I have to manually set the value of all my selectboxes or is there
automatic binding like in the form that uses the id of a textbox to find the
corresponding record in the form model.
Also will the selectbox be two way so if I change the value it changes the
value in the form model.
Thanks,
Dan
--
View this message in context:
http://qooxdoo.678.n2.nabble.com/Selectbox-form-model-binding-and-set-selected-value-to-form-model-tp7584244.html
Sent from the qooxdoo mailing list archive at Nabble.com.
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel