diff --git a/etemplate/js/et2_core_inputWidget.js b/etemplate/js/et2_core_inputWidget.js index c5c0b5eb86..78ff62c874 100644 --- a/etemplate/js/et2_core_inputWidget.js +++ b/etemplate/js/et2_core_inputWidget.js @@ -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); } } }, diff --git a/etemplate/js/et2_widget_tabs.js b/etemplate/js/et2_widget_tabs.js index b8ebdaf4b7..b050e10411 100644 --- a/etemplate/js/et2_widget_tabs.js +++ b/etemplate/js/et2_widget_tabs.js @@ -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) {