Hello Christian,
i just checked your code to see how to improve it and if its the right way.
I have a few comments for you:
// create a Qooxdoo array to wrap raw data array.
var arrayWrapper = new qx.data.Array();
// iterate over the raw data and create a model
for (var index = 0; index < rawData.length; index++) {
var rawObject = rawData[index];
var personModel = qx.data.marshal.Json.createModel(rawObject);
this.debug("person created: "
+ qx.dev.Debug.debugProperties(personModel));
arrayWrapper.push(personModel);
}
You can get that result much easier. Just use the marshaler on the raw data
and thats it. It will create a data array for you!
var arrayWrapper = qx.data.marshal.Json.createModel(rawData);
var resetter = new qx.ui.form.Resetter();
resetter.add(nameTextField);
resetButton.addListener("execute", function() {
resetter.reset()
}, this);
The form itself has an internal resetter for all your added form items. So
you don't need to create an extra resetter for your form. Just use the
following:
resetButton.addListener("execute", function() {
inputForm.reset()
}, this);
Now to the dat binding part. (Thats my favorite part)
You try to use a form controller which is working but its kind of oversized
for that task. Just create a new model object using the marshaler and push
it to the array.
saveButton.addListener("execute", function() {
if (inputForm.validate()) {
var value = nameTextField.getValue();
var newItem = qx.data.marshal.Json.createModel({name: value});
arrayWrapper.push(newItem);
}
}, this);
I hope that helps a bit. :)
Best,
Martin
--
View this message in context:
http://n2.nabble.com/Ask-Form-and-List-Data-Binding-tp4575300p4584808.html
Sent from the qooxdoo mailing list archive at Nabble.com.
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel