Class: UWA.Controls.TabView.Tab

UWA/Controls/TabView. UWA.Controls.TabView.Tab

new UWA.Controls.TabView.Tab(options)

Provides Tab instances for use with TabView.

Example
var CustomTab = UWA.Controls.TabView.Tab.extend({

    // Overrides base method
    _createInnerTabElement: function () {
        // Build custom DOM
        return UWA.createElement('div', {text: 'content'});
    }
});

var tabView = new UWA.Controls.TabView();
tabView.addTab(new CustomTab({id: 'someId', text: 'Custom tab'}));
Parameters
Name Type Description
options Object

Options hash or a option/value pair.

Properties
Name Type Argument Default Description
id String <optional>
''

If set, assign a unique ID to the Tab.

disabled Boolean <optional>
false

If set, Tab can not be activated.

selected Boolean <optional>
false

If set, Tab is made active.

Extends

  • UWA.Controls.Abstract

Index

Methods

getId() → {String}

Return the tab unique identifier.

Returns
Type
String

getName() → {String}

Return the tab name.

Returns
Type
String

getText()

Return the tab title.

setIcon(url) → {Tab}

Set the tab icon.

Parameters
Name Type Description
url String | Boolean

Icon URL or false to remove icon.

Returns

Fluent interface

Type
Tab

setText(Tab) → {Tab}

Set the tab label text.

Parameters
Name Type Description
Tab String

label

Returns

Fluent interface

Type
Tab

setDisabled(disabled) → {Tab}

Enable or disable this tab.

Parameters
Name Type Description
disabled Boolean

Whether or not to disable the tab

Returns

Fluent interface

Type
Tab

setSelected(selected) → {Tab}

Select or unselect the tab.

Parameters
Name Type Description
selected Boolean

true to select the tab, false to unselect.

Returns

Fluent interface

Type
Tab

setContent(content) → {Tab}

Set the content. Or will do nothing if not content set.

Parameters
Name Type Description
content String | Element

Tab panel content

Returns

Fluent interface

Type
Tab

isSelectable() → {Boolean}

Whether or not this tab can be selected by default when there is no selected tab.

Returns
Type
Boolean

isSelected() → {Boolean}

Whether or not this tab is selected.

Returns

true if the tab is selected, false otherwise

Type
Boolean

isDisabled() → {Boolean}

Whether or not this tab is disabled.

Returns

true if the tab is disabled, false otherwise

Type
Boolean

remove()

Remove tab from DOM.

tabElement() → {HTMLElement}

Return Tab HTML element.

Default HTML:

<li id="xxx" class="[uwa-tab]">
    <a href="#content"><span class="title">Title<span></a>
</li>
Returns
Type
HTMLElement

contentElement() → {HTMLElement}

Return the Tab panel HTML element (content).

Returns
Type
HTMLElement