Skip to main content

gadgets.TabSet

Constructor​

gadgets.TabSet​

gadgets.TabSet(opt_moduleId, opt_defaultTab, opt_container)

Creates a new TabSet object.

Parameter​
NameTypeDescription
opt_moduleIdStringModule ID.
opt_defaultTabStringDefault Tab name that is selected after it is generated.
opt_containerElementHTML container elements that include a Tab.
Sample​
var tabs = new gadgets.TabSet(__MODULE_ID__, 'tab1', document.getElementById("tabs"));

Method​

gadgets.TabSet.addTab​

String addTab(tabName, opt_params)

Adds a Tab.

Parameter​
NameTypeDescription
tabNameStringLabel for the Tab to be created.
opt_paramsObjectParameter object.
Return value​
TypeDescription
StringDOM ID for a Tab container.

gadgets.TabSet.alignTabs​

alignTabs(align, opt_offset)

Sets the Tab layout. By default, tabs are centered.

Parameter​
NameTypeDescription
alignStringPosition of the Tabs. It is either "left", "center", or "right".
opt_offsetNumberParameter for setting the number of pixels that offsets the Tab from the left end or the right end. Default is 3px.
Return value​

None

Sample​
tabs.addTab("tab1", {
contentContainer: document.getElementById("tab1")
});

gadgets.TabSet.displayTabs​

displayTAbs(display)

Switches between show/hide for all of the Tabs and contents linked to the Tabs.

Parameter​
NameTypeDescription
displayBooleanThe Tab is shown when it is "True". It is hidden when it is "False".
Return value​

None

Sample​
tabs.display(true);

gadgets.TabSet.getHeaderContainer​

Element getHeaderContainer()

Returns the Tab header container element.

Parameter​

None

Return value​
TypeDescription
ElementTab header container element.
Sample​
var elem = tabs.getHeaderContainer();

gadgets.TabSet.getSelectedTab​

gadgets.Tab getSelectedTab()

Returns the Tab object that is currently selected.

Parameter​

None

Return value​
TypeDescription
gadgets.TabTab object that is currently selected.
Sample​
var tab = tabs.getSelectedTab();

gadgets.TabSet.getTabs​

Array.<gadgets.Tab> getTabs()

Returns the array of all existing Tab objects.

Parameter​

None

Return value​
TypeDescription
Array.<gadgets.Tab>Array of all existing Tab objects.

gadgets.TabSet.removeTab​

removeTab(tabIndex)

Deletes Tabs in tabIndex and the contents that are linked to the Tabs.

Parameter​
NameTypeDescription
tabIndexNumberIndex of the Tabs to be deleted.
Return value​

None

gadgets.TabSet.setSelectedTab​

setSelectedTab(tabIndex)

Selects the Tab in tabIndex and calls the Tab’s callback function, if there is one. If the Tab has already been selected, callback will not be called.

Parameter​
NameTypeDescription
tabIndexNumberIndex of the Tab to be selected.
Return value​

None

Sample​
tabs.setSelectedTab(2);

gadgets.TabSet.swapTabs​

swapTabs(tabIndex1. tabIndex2)

Switches the positions of Tabs that are in tabIndex1 and tabIndex2. The selected Tabs are not modified, and the callback function is not called either.

Parameter​
NameTypeDescription
tabIndex1NumberIndex for the first Tab to be switched.
tabIndex2NumberIndex for the second Tab to be switched.
Return value​

None

Sample​
tabs.swapTabs(3, 2);

Revision History​

  • 12/2010
    • Initial Release.