Hello All,
I'm looking for some advice on how to neatly associate UI widgets with
server-side Objects (and/or database records).
Qx widgets are a great way of representing server-side Objects; the trick is how
to best identify which Object to update when the user touches a UI widgets.
E.g. when a user adds a node to a Qxtree that represents a server-side object
instance, or when a user updates the values in a Qx "form" that represents a db
record.
I often find myself thinking about extending Qx widgets just to add a "refId"
property (an object or reference identifier) - something like this:
function ExtendedQxTreeFile(vLabel, vRefId) {
QxTreeFile.call(this, vLabel);
if (typeof vRefId != QxConst.TYPEOF_UNDEFINED) {
this.setRefId(vRefId);
};
};
ExtendedQxTreeFile.extend(QxTreeFile, "ExtendedQxTreeFile");
ExtendedQxTreeFile.addProperty({ name : "refId", type : QxConst.TYPEOF_STRING
});
Then I can then pass refId to the backend when change events are fired, by doing
something like this:
var myFormField = new QxTextField;
myFormField.addEventListener("changeValue", function(e) {
updateProperty( this.refId, e.getNewValue() );
});
This works well enough, but I don't feel very comfortable with it because I need
to use specialised subclasses for every widget that needs to update a
server-side Object. This means more javascript classes that will probably
require ongoing updates if/when their Qx superclasses are modified.
Does anyone have a nicer solution?
Thanks,
Simon
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel