Fixed problem with getValues iterating over widgets which are in proxied templates

This commit is contained in:
Andreas Stöckel 2011-08-15 10:04:37 +00:00
parent 29c16431ad
commit f9914e069c
2 changed files with 28 additions and 13 deletions

View File

@ -148,17 +148,8 @@ var et2_template = et2_DOMWidget.extend({
return this.div;
},
getValues: function(_target) {
if (this.proxiedTemplate)
{
return this.proxiedTemplate.getValues(_target);
}
else if (!this.isProxied)
{
return this._super(_target);
}
return _target;
isInTree: function() {
return this._super(!this.isProxied);
}
});

View File

@ -315,7 +315,7 @@ var et2_widget = Class.extend({
_type = et2_widget;
}
if (this.instanceOf(_type))
if (this.isInTree() && this.instanceOf(_type))
{
_callback.call(_context, this);
}
@ -326,6 +326,30 @@ var et2_widget = Class.extend({
}
},
/**
* Returns true if the widget currently resides in the visible part of the
* widget tree. E.g. Templates which have been cloned are not in the visible
* part of the widget tree.
*
* @param _vis can be used by widgets overwriting this function - simply
* write
* return this._super(inTree);
* when calling this function the _vis parameter does not have to be supplied.
*/
isInTree: function(_vis) {
if (typeof _vis == "undefined")
{
_vis = true;
}
if (this._parent)
{
return _vis && this._parent.isInTree();
}
return _vis;
},
isOfSupportedWidgetClass: function(_obj)
{
for (var i = 0; i < this.supportedWidgetClasses.length; i++)
@ -529,7 +553,7 @@ var et2_widget = Class.extend({
// Check whether the entry is really undefined
if (typeof _target[_widget.id] != "undefined")
{
et2_debug("error", "Overwriting value of '" + this.id +
et2_debug("error", "Overwriting value of '" + _widget.id +
"', id exists twice!");
}