This is what I do in TypeScript (qx-typed):
I created a map of getters and setters taking advantage of closure technique
like this:
// A function or method to add a SelectBox control
this.addMap(name, control, util.SqlDataType.UByte,
(s) => ui.setSelectedIndex(control, s), //
setter
() => ui.getSelectedIndex(control).toString()); //
getter
util.SqlDataType.UByte indicates the data type conversion to be taken care
of by the server-side from a string value so all getters convert to string
so that server side will only convert from string directly.
>From this technique, getting the values in the selected controls in the form
is simply done as:
// getPars()
names.forEach(e => {
for (var i = 0; i < count; i++) {
var par = this.pars[i];
if (par.Name === e) {
par.Value =
this.controls[this.pars[i].Name].getter(); // note the getter execution
here!
pars.push(par);
break;
}
}
});
The JSON request is sent like this:
util.postJson<util.RequestNewRecord, <b>number*>(this,
"newrecord", {
TableName: this.entry.tableName,
Pars: this.entry.getPars() // getPars retrieves
needed values from form
}, (r) => {
// r is a *number *returned from server which is Id of the
new record created in table
});
This technique simplifies retrieval of ready-to-send data with a single call
to getPars().
--
View this message in context:
http://qooxdoo.678.n2.nabble.com/list-controller-does-not-update-list-tp7586693p7586695.html
Sent from the qooxdoo mailing list archive at Nabble.com.
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel