gadgets.TabSet
Constructor
gadgets.TabSet
gadgets.TabSet(opt_moduleId, opt_defaultTab, opt_container)
Creates a new TabSet object.
Parameter
| Name | Type | Description |
|---|---|---|
| opt_moduleId | String | Module ID. |
| opt_defaultTab | String | Default Tab name that is selected after it is generated. |
| opt_container | Element | HTML 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
| Name | Type | Description |
|---|---|---|
| tabName | String | Label for the Tab to be created. |
| opt_params | Object | Parameter object. |
Return value
| Type | Description |
|---|---|
| String | DOM ID for a Tab container. |
gadgets.TabSet.alignTabs
alignTabs(align, opt_offset)
Sets the Tab layout. By default, tabs are centered.
Parameter
| Name | Type | Description |
|---|---|---|
| align | String | Position of the Tabs. It is either "left", "center", or "right". |
| opt_offset | Number | Parameter 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
| Name | Type | Description |
|---|---|---|
| display | Boolean | The 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
| Type | Description |
|---|---|
| Element | Tab 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
| Type | Description |
|---|---|
| gadgets.Tab | Tab 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
| Type | Description |
|---|---|
| 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
| Name | Type | Description |
|---|---|---|
| tabIndex | Number | Index 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
| Name | Type | Description |
|---|---|---|
| tabIndex | Number | Index 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
| Name | Type | Description |
|---|---|---|
| tabIndex1 | Number | Index for the first Tab to be switched. |
| tabIndex2 | Number | Index for the second Tab to be switched. |
Return value
None
Sample
tabs.swapTabs(3, 2);
Revision History
- 12/2010
- Initial Release.