mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
Add a new function activateTab(widget) to activate a tab containing a given widget, move previous code inside tab widget to properly encapsulate it. Fixes broken tab selection with deferred tab loading, wrong tab shown if a widget has a validation error.
This commit is contained in:
parent
d3ef9ea496
commit
683310ba94
@ -252,10 +252,7 @@ var et2_inputWidget = et2_valueWidget.extend([et2_IInput,et2_ISubmitListener],
|
||||
tab = widget;
|
||||
widget = widget._parent;
|
||||
}
|
||||
if(!widget || typeof widget.setActiveTab == 'undefined') return;
|
||||
var index = widget._children.indexOf(tab);
|
||||
widget.setActiveTab(index);
|
||||
console.log(widget);
|
||||
widget.activateTab(this);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -350,6 +350,31 @@ var et2_tabbox = et2_valueWidget.extend([et2_IInput],
|
||||
this.tabContainer.children(":eq(" + _idx + ")").show();
|
||||
},
|
||||
|
||||
/**
|
||||
* Activate the tab containing the given widget
|
||||
*
|
||||
* @param {et2_widget} widget
|
||||
* @return {bool} widget was found in a tab
|
||||
*/
|
||||
activateTab: function(widget) {
|
||||
var tab = widget;
|
||||
while(tab._parent && tab._parent._type !='tabbox')
|
||||
{
|
||||
tab = tab._parent;
|
||||
}
|
||||
|
||||
var child_index = this._children.indexOf(tab);
|
||||
for(var i = 0; i < this.tabData.length; i++)
|
||||
{
|
||||
if(this.tabData[i].widget == tab)
|
||||
{
|
||||
this.setActiveTab(i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
getDOMNode: function(_sender) {
|
||||
if (_sender == this)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user