mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-25 12:21:26 +02:00
Add a function to get information about the tab a widget is on
This commit is contained in:
parent
4308444034
commit
a462f30f9c
@ -248,6 +248,42 @@ var et2_DOMWidget = (function(){ "use strict"; return et2_widget.extend(et2_IDOM
|
|||||||
return this._surroundingsMgr;
|
return this._surroundingsMgr;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get data for the tab this widget is on.
|
||||||
|
*
|
||||||
|
* Will return null if the widget is not on a tab or tab data containing
|
||||||
|
* - id
|
||||||
|
* - label
|
||||||
|
* - widget (top level widget)
|
||||||
|
* - contentDiv (jQuery object for the div the tab content is in)
|
||||||
|
*
|
||||||
|
* @returns {Object|null} Data for tab the widget is on
|
||||||
|
*/
|
||||||
|
get_tab_info: function() {
|
||||||
|
var parent = this;
|
||||||
|
do {
|
||||||
|
parent = parent._parent;
|
||||||
|
} while (parent !== this.getRoot() && parent._type !== 'tabbox');
|
||||||
|
|
||||||
|
// No tab
|
||||||
|
if(parent === this.getRoot())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the tab index
|
||||||
|
for(var i = 0; i < parent.tabData.length; i++)
|
||||||
|
{
|
||||||
|
// Find the tab
|
||||||
|
if(parent.tabData[i].contentDiv.has(this.div).length)
|
||||||
|
{
|
||||||
|
return parent.tabData[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// On a tab, but we couldn't find it? This gives best result so far.
|
||||||
|
return this._parent.get_tab_info();
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the parent DOM node of this element. Takes a wider variety of types
|
* Set the parent DOM node of this element. Takes a wider variety of types
|
||||||
* than setParentDOMNode(), and matches the set_<attribute> naming convention.
|
* than setParentDOMNode(), and matches the set_<attribute> naming convention.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user