Class MochiKit.Widget.TabContainer
Extends
MochiKit.Widget.
The tab container widget class. Used to provide a set of
tabbed pages, where the user can switch page freely.
Internally it uses a <div> HTML element containing Pane
widgets that are hidden and shown according to the page
transitions. If a child Pane widget is "pageCloseable", a
close button will be available on the tab label and an
"onclose" signal will be emitted for that node when removed
from the container.
Defined in: Widget.js.
Constructor Attributes | Constructor Name and Description |
---|---|
MochiKit.Widget.TabContainer(attrs)
Creates a new tab container widget.
|
- Fields borrowed from class MochiKit.Widget:
- _id, Classes
Method Attributes | Method Name and Description |
---|---|
_handleClose(child, evt)
Handles the tab close event.
|
|
addChildNode(child)
Adds a single child page widget to this widget.
|
|
Returns an array with all child pane widgets.
|
|
removeChildNode(child)
Removes a single child DOM node from this widget.
|
|
Resizes the currently selected child.
|
|
selectChild(indexOrChild)
Selects a specified child in the tab container.
|
|
Returns the child widget currently selected in the tab container.
|
|
Returns the index of the currently selected child in the tab
container.
|
- Methods borrowed from class MochiKit.Widget:
- _animQueueId, _createWidgetTreeElem, _eventHandler, _widgetMixin, addAll, addClass, animate, blurAll, createWidget, createWidgetTree, destroy, destroyWidget, emitSignal, hasClass, hide, isFormField, isHidden, isWidget, removeAll, removeClass, setAttrs, setStyle, show, toggleClass
Class Detail
MochiKit.Widget.TabContainer(attrs)
Creates a new tab container widget.
- Parameters:
- {Object} attrs
- the widget and node attributes
- {Widget} ... Optional
- the child widgets or DOM nodes (should be Pane widgets)
- Returns:
- {Widget} the widget DOM node
Method Detail
_handleClose(child, evt)
Handles the tab close event.
- Parameters:
- {Node} child
- the child DOM node
- {Event} evt
- the MochiKit.Signal.Event object
addChildNode(child)
Adds a single child page widget to this widget. The child widget
should be a MochiKit.Widget.Pane widget, or it will be added to a
new one.
- Parameters:
- {Widget} child
- the page widget to add
{Array}
getChildNodes()
Returns an array with all child pane widgets. Note that the array
is a real JavaScript array, not a dynamic NodeList.
- Returns:
- {Array} the array of child DOM nodes
removeChildNode(child)
Removes a single child DOM node from this widget. This method is
sometimes overridden by child widgets in order to hide or control
intermediate DOM nodes required by the widget.
Note that this method will NOT destroy the removed child widget, so care must be taken to ensure proper child widget destruction.
- Parameters:
- {Widget/Node} child
- the DOM node to remove
resizeContent()
Resizes the currently selected child. This method need not be called
directly, but is automatically called whenever a parent node is
resized. It optimizes the resize chain by only resizing those DOM
child nodes that are visible, i.e. the currently selected tab
container child.
selectChild(indexOrChild)
Selects a specified child in the tab container. This method can be
called without arguments to re-select the currently selected tab.
- Parameters:
- {Number/Node} indexOrChild Optional
- the child index or node
{Node}
selectedChild()
Returns the child widget currently selected in the tab container.
- Returns:
- {Node} the child widget selected, or null if no child is selected
{Number}
selectedIndex()
Returns the index of the currently selected child in the tab
container.
- Returns:
- {Number} the index of the selected child, or -1 if no child is selected