Print Friendly

# Class Ext.TabPanelItem

Package: | Ext
Class: | TabPanelItem
Extends: | Observable
Defined In: | TabPanel.js

Represents an individual item (tab plus body) in a TabPanel.
Properties - Methods - Events

## Public Properties

Property | Defined By
--- | ---
| bodyEl : Ext.Element | TabPanelItem
The body element for this TabPanelItem.
| closeText : String | TabPanelItem
The text displayed in the tooltip for the close icon.
| id : String | TabPanelItem
The id for this TabPanelItem
| tabPanel : Ext.TabPanel | TabPanelItem
The Ext.TabPanel this TabPanelItem belongs to

## Public Methods

Method | Defined By
--- | ---
| activate() : void | TabPanelItem
Activates this TabPanelItem -- this does deactivate the currently active TabPanelItem.
| addEvents( `Object object` ) : void | Observable
Used to define events on this Observable
| addListener( `String eventName`, `Function handler`, [`Object scope`], [`Object options`] ) : void | Observable
Appends an event handler to this component
| disable() : void | TabPanelItem
Disables this TabPanelItem -- this does nothing if this is the active TabPanelItem.
| enable() : void | TabPanelItem
Enables this TabPanelItem if it was previously disabled.
| fireEvent( `String eventName`, `Object... args` ) : Boolean | Observable
Fires the specified event with the passed parameters (minus the event name).
| getText() : String | TabPanelItem
Returns the text for this tab
| getUpdateManager() : Ext.UpdateManager | TabPanelItem
Gets the Ext.UpdateManager for the body of this TabPanelItem. Enables you to perform Ajax updates.
| hasListener( `String eventName` ) : Boolean | Observable
Checks to see if this object has any listeners for a specified event
| hide() : void | TabPanelItem
Hides this TabPanelItem -- if you don't activate another TabPanelItem this could look odd.
| isActive() : Boolean | TabPanelItem
Returns true if this tab is the active tab.
| isHidden() : Boolean | TabPanelItem
Returns true if this tab is "hidden"
| on( `String eventName`, `Function handler`, [`Object scope`], [`Object options`] ) : void | Observable
Appends an event handler to this element (shorthand for addListener)
| purgeListeners() : void | Observable
Removes all listeners for this object
| refresh() : void | TabPanelItem
Forces a content refresh from the URL specified in the setUrl method. Will fail silently if the setUrl method has not...
| removeListener( `String eventName`, `Function handler`, [`Object scope`] ) : void | Observable
Removes a listener
| setContent( `String content`, `Boolean loadScripts` ) : void | TabPanelItem
Sets the content for this TabPanelItem.
| setHidden( `Boolean hidden` ) : void | TabPanelItem
Show or hide the tab
| setText( `String text` ) : void | TabPanelItem
Sets the text for the tab (Note: this also sets the tooltip text)
| setTooltip( `String tooltip` ) : void | TabPanelItem
Set the tooltip for the tab.
| setUrl( `String/Function url`, [`String/Object params`], [`Boolean loadOnce`] ) : Ext.UpdateManager | TabPanelItem
Set a URL to be used to load the content for this TabPanelItem.
| show() : void | TabPanelItem
Shows this TabPanelItem -- this does not deactivate the currently active TabPanelItem.
| un( `String eventName`, `Function handler`, [`Object scope`] ) : void | Observable
Removes a listener (shorthand for removeListener)

## Public Events

Event | Defined By
--- | ---
| activate : ( `Ext.TabPanel tabPanel`, `Ext.TabPanelItem this` ) | TabPanelItem
Fires when this tab becomes the active tab.
| beforeclose : ( `Ext.TabPanelItem this`, `Object e` ) | TabPanelItem
Fires before this tab is closed. To cancel the close, set cancel to true on e (e.cancel = true).
| close : ( `Ext.TabPanelItem this` ) | TabPanelItem
Fires when this tab is closed.
| deactivate : ( `Ext.TabPanel tabPanel`, `Ext.TabPanelItem this` ) | TabPanelItem
Fires when this tab is no longer the active tab.

## Property Details

### bodyEl

`public Ext.Element bodyEl`
The body element for this TabPanelItem.
This property is defined by TabPanelItem.

### closeText

`public String closeText`
The text displayed in the tooltip for the close icon.
This property is defined by TabPanelItem.

### id

`public String id`
The id for this TabPanelItem
This property is defined by TabPanelItem.

### tabPanel

`public Ext.TabPanel tabPanel`
The Ext.TabPanel this TabPanelItem belongs to
This property is defined by TabPanelItem.

## Method Details

### activate

`public function activate()`
Activates this TabPanelItem -- this does deactivate the currently active TabPanelItem.
Parameters:

- None.

Returns:

- `void`

This method is defined by TabPanelItem.

### addEvents

`public function addEvents( `Object object` )`
Used to define events on this Observable
Parameters:

- `object` : Object
  The object with the events defined

Returns:

- `void`

This method is defined by Observable.

### addListener

`public function addListener( `String eventName`, `Function handler`, [`Object scope`], [`Object options`] )`
Appends an event handler to this component
Parameters:

- `eventName` : String
  The type of event to listen for
- `handler` : Function
  The method the event invokes
- `scope` : Object
  (optional) The scope in which to execute the handler function. The handler function's "this" context.
- `options` : Object
  (optional) An object containing handler configuration properties. This may contain any of the following properties:
  - scope {Object} The scope in which to execute the handler function. The handler function's "this" context.
  - delay {Number} The number of milliseconds to delay the invocation of the handler after te event fires.
  - single {Boolean} True to add a handler to handle just the next firing of the event, and then remove itself.
  - buffer {Number} Causes the handler to be scheduled to run in an Ext.util.DelayedTask delayed by the specified number of milliseconds. If the event fires again within that time, the original handler is not invoked, but the new handler is scheduled in its place.

  Combining Options
  Using the options argument, it is possible to combine different types of listeners:
  A normalized, delayed, one-time listener that auto stops the event and passes a custom argument (forumId)

      el.on('click', this.onClick, this, {
       			single: true,
          		delay: 100,
          		forumId: 4
      		});

  Attaching multiple handlers in 1 call
  The method also allows for a single argument to be passed which is a config object containing properties which specify multiple handlers.

      el.on({
      			'click': {
              		fn: this.onClick,
              		scope: this,
              		delay: 100
          		},
          		'mouseover': {
              		fn: this.onMouseOver,
              		scope: this
          		},
          		'mouseout': {
              		fn: this.onMouseOut,
              		scope: this
          		}
      		});

  Or a shorthand syntax which passes the same scope object to all handlers:

      el.on({
      			'click': this.onClick,
          		'mouseover': this.onMouseOver,
          		'mouseout': this.onMouseOut,
          		scope: this
      		});

Returns:

- `void`

This method is defined by Observable.

### disable

`public function disable()`
Disables this TabPanelItem -- this does nothing if this is the active TabPanelItem.
Parameters:

- None.

Returns:

- `void`

This method is defined by TabPanelItem.

### enable

`public function enable()`
Enables this TabPanelItem if it was previously disabled.
Parameters:

- None.

Returns:

- `void`

This method is defined by TabPanelItem.

### fireEvent

`public function fireEvent( `String eventName`, `Object... args` )`
Fires the specified event with the passed parameters (minus the event name).
Parameters:

- `eventName` : String
- `args` : Object...
  Variable number of parameters are passed to handlers

Returns:

- `Boolean`
  returns false if any of the handlers return false otherwise it returns true

This method is defined by Observable.

### getText

`public function getText()`
Returns the text for this tab
Parameters:

- None.

Returns:

- `String`

This method is defined by TabPanelItem.

### getUpdateManager

`public function getUpdateManager()`
Gets the Ext.UpdateManager for the body of this TabPanelItem. Enables you to perform Ajax updates.
Parameters:

- None.

Returns:

- `Ext.UpdateManager`
  The UpdateManager

This method is defined by TabPanelItem.

### hasListener

`public function hasListener( `String eventName` )`
Checks to see if this object has any listeners for a specified event
Parameters:

- `eventName` : String
  The name of the event to check for

Returns:

- `Boolean`
  True if the event is being listened for, else false

This method is defined by Observable.

### hide

`public function hide()`
Hides this TabPanelItem -- if you don't activate another TabPanelItem this could look odd.
Parameters:

- None.

Returns:

- `void`

This method is defined by TabPanelItem.

### isActive

`public function isActive()`
Returns true if this tab is the active tab.
Parameters:

- None.

Returns:

- `Boolean`

This method is defined by TabPanelItem.

### isHidden

`public function isHidden()`
Returns true if this tab is "hidden"
Parameters:

- None.

Returns:

- `Boolean`

This method is defined by TabPanelItem.

### on

`public function on( `String eventName`, `Function handler`, [`Object scope`], [`Object options`] )`
Appends an event handler to this element (shorthand for addListener)
Parameters:

- `eventName` : String
  The type of event to listen for
- `handler` : Function
  The method the event invokes
- `scope` : Object
  (optional) The scope in which to execute the handler function. The handler function's "this" context.
- `options` : Object
  (optional)

Returns:

- `void`

This method is defined by Observable.

### purgeListeners

`public function purgeListeners()`
Removes all listeners for this object
Parameters:

- None.

Returns:

- `void`

This method is defined by Observable.

### refresh

`public function refresh()`
Forces a content refresh from the URL specified in the setUrl method. Will fail silently if the setUrl method has not been called. This does not activate the panel, just updates its content.
Parameters:

- None.

Returns:

- `void`

This method is defined by TabPanelItem.

### removeListener

`public function removeListener( `String eventName`, `Function handler`, [`Object scope`] )`
Removes a listener
Parameters:

- `eventName` : String
  The type of event to listen for
- `handler` : Function
  The handler to remove
- `scope` : Object
  (optional) The scope (this object) for the handler

Returns:

- `void`

This method is defined by Observable.

### setContent

`public function setContent( `String content`, `Boolean loadScripts` )`
Sets the content for this TabPanelItem.
Parameters:

- `content` : String
  The content
- `loadScripts` : Boolean
  true to look for and load scripts

Returns:

- `void`

This method is defined by TabPanelItem.

### setHidden

`public function setHidden( `Boolean hidden` )`
Show or hide the tab
Parameters:

- `hidden` : Boolean
  True to hide or false to show.

Returns:

- `void`

This method is defined by TabPanelItem.

### setText

`public function setText( `String text` )`
Sets the text for the tab (Note: this also sets the tooltip text)
Parameters:

- `text` : String
  The tab's text and tooltip

Returns:

- `void`

This method is defined by TabPanelItem.

### setTooltip

`public function setTooltip( `String tooltip` )`
Set the tooltip for the tab.
Parameters:

- `tooltip` : String
  The tab's tooltip

Returns:

- `void`

This method is defined by TabPanelItem.

### setUrl

`public function setUrl( `String/Function url`, [`String/Object params`], [`Boolean loadOnce`] )`
Set a URL to be used to load the content for this TabPanelItem.
Parameters:

- `url` : String/Function
  The URL to load the content from, or a function to call to get the URL
- `params` : String/Object
  (optional) The string params for the update call or an object of the params. See Ext.UpdateManager.update for more details. (Defaults to null)
- `loadOnce` : Boolean
  (optional) Whether to only load the content once. If this is false it makes the Ajax call every time this TabPanelItem is activated. (Defaults to false)

Returns:

- `Ext.UpdateManager`
  The UpdateManager

This method is defined by TabPanelItem.

### show

`public function show()`
Shows this TabPanelItem -- this does not deactivate the currently active TabPanelItem.
Parameters:

- None.

Returns:

- `void`

This method is defined by TabPanelItem.

### un

`public function un( `String eventName`, `Function handler`, [`Object scope`] )`
Removes a listener (shorthand for removeListener)
Parameters:

- `eventName` : String
  The type of event to listen for
- `handler` : Function
  The handler to remove
- `scope` : Object
  (optional) The scope (this object) for the handler

Returns:

- `void`

This method is defined by Observable.

## Event Details

### activate

`public event activate`
Fires when this tab becomes the active tab.
Subscribers will be called with the following parameters:

- `tabPanel` : Ext.TabPanel
  The parent TabPanel
- `this` : Ext.TabPanelItem

This event is defined by TabPanelItem.

### beforeclose

`public event beforeclose`
Fires before this tab is closed. To cancel the close, set cancel to true on e (e.cancel = true).
Subscribers will be called with the following parameters:

- `this` : Ext.TabPanelItem
- `e` : Object
  Set cancel to true on this object to cancel the close.

This event is defined by TabPanelItem.

### close

`public event close`
Fires when this tab is closed.
Subscribers will be called with the following parameters:

- `this` : Ext.TabPanelItem

This event is defined by TabPanelItem.

### deactivate

`public event deactivate`
Fires when this tab is no longer the active tab.
Subscribers will be called with the following parameters:

- `tabPanel` : Ext.TabPanel
  The parent TabPanel
- `this` : Ext.TabPanelItem

This event is defined by TabPanelItem.

Ext - Copyright © 2006-2007 Ext JS, LLC
All rights reserved.