Sebastian Werner schrieb:
Christian Boulanger schrieb:
Hi all,
sometimes it is useful to attach data to qooxdoo widgets which is not
represented by the native properties, for example in a tree,
information about the tree element owner, write protection,
description of the tree node, etc. etc. Now I can go ahead and attach
any property I want to the widget. But in order to prevent clashes
with property names of future versions of the widget, it would make
sense to me to have a native method getUserData() and setUserData()
available in all widgets which lets me store such data without
worrying about conflicts.
This is super-easy and painless to implement, and I would like to
request to include it in the next release:
QxWidget.prototype.getUserData = function()
{
return this._userData;
}
QxWidget.prototype.setUserData = function(data)
{
this._userData = data;
}
Hi Christian,
I have just removed our old methods addData and removeData from
QxObject as they are far to complex. I have no added these methods to
CVS which should allow you to have a nice, fast interface to store
some data to your objects.
Compared to your solution, I found it useful to handle the different
fields inside the class.
proto.setUserData(vKey, vValue)
{
if (!this._userData) {
this._userData = {};
};
this._userData[vKey] = vValue;
};
proto.getUserData(vKey)
{
if (!this._userData) {
return null;
};
return this._userData[vKey];
};
You can now do a myTreeFolder.setUserData("readOnly", true);
Hope you like it.
Regards,
Sebastian
I like it alot!!! Thank you very much for your quick reaction. Hurray to
QooxDoo!
C.
-------------------------------------------------------
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://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel