Print Friendly

# Class YAHOO.ext.ContentPanel

Package: | YAHOO.ext
Class: | ContentPanel
Extends: | Observable
Subclasses: | GridPanel, NestedLayoutPanel
Defined In: | ContentPanels.js

A basic ContentPanel element.

## Public Properties

This class has no public properties.

## Public Methods

Method | Defined By
--- | ---
| ContentPanel(`String/HTMLElement/Element el`, `String/Object config`, [`String content`]) | ContentPanel
Create a new ContentPanel.
| addListener(`String eventName`, `Function handler`, [`Object scope`], [`boolean override`]) : void | Observable
Appends an event handler to this element
| delayedListener(`String eventName`, `Function handler`, [`Object scope`], [`Number delay`]) : Function | Observable
Appends an event handler to this element that is delayed the specified number of milliseconds.
| destroy() : void | ContentPanel
Destroys this panel
| fireEvent(`String eventName`, `Object... args`) : Boolean | Observable
Fires the specified event with the passed parameters (minus the event name).
| getEl() : YAHOO.ext.Element | ContentPanel
Returns this panel's element
| getId() : String | ContentPanel
Returns this panel's id
| getTitle() : String | ContentPanel
Returns this panel's title
| getToolbar() : YAHOO.ext.Toolbar | ContentPanel
Returns the toolbar for this Panel if one was configured
| getUpdateManager() : YAHOO.ext.UpdateManager | ContentPanel
Get the YAHOO.ext.UpdateManager for this panel. Enables you to perform Ajax updates.
| isClosable() : Boolean | ContentPanel
Returns true is this panel was configured to be closable
| purgeListeners() : void | Observable
Removes all listeners for this object
| removeListener(`String eventName`, `Function handler`, [`Object scope`]) : void | Observable
Removes a listener
| setContent(`String content`, [`Boolean loadScripts`]) : void | ContentPanel
Updates this panel's element
| setTitle(`String title`) : void | ContentPanel
Set this panel's title
| setUrl(`String/Function url`, [`String/Object params`], [`Boolean loadOnce`]) : YAHOO.ext.UpdateManager | ContentPanel
Set a URL to be used to load the content for this panel.

## Public Events

Event | Defined By
--- | ---
| activate : (`YAHOO.ext.ContentPanel this`) | ContentPanel
Fires when this panel is activated.
| deactivate : (`YAHOO.ext.ContentPanel this`) | ContentPanel
Fires when this panel is activated.

## Constructor Details

### ContentPanel

`public function ContentPanel(`String/HTMLElement/Element el`, `String/Object config`, [`String content`])`
Create a new ContentPanel.
Parameters:

- `el` : String/HTMLElement/Element
  The container element for this panel
- `config` : String/Object
  A string to set only the title or a config object
- `content` : String
  (optional) Set the HTML content for this panel

## Method Details

### addListener

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

- `eventName` : String
  The type of event to listen for
- `handler` : Function
  The method the event invokes
- `scope` : Object
  (optional) The scope (this object) for the handler
- `override` : boolean
  (optional) If true, scope becomes the scope

Returns:

- `void`

This method is defined by Observable.

### delayedListener

`public function delayedListener(`String eventName`, `Function handler`, [`Object scope`], [`Number delay`])`
Appends an event handler to this element that is delayed the specified number of milliseconds.
Parameters:

- `eventName` : String
  The type of event to listen for
- `handler` : Function
  The method the event invokes
- `scope` : Object
  (optional) The scope (this object) for the handler
- `delay` : Number
  (optional) The number of milliseconds to delay

Returns:

- `Function`
  The wrapped function that was created (can be used to remove the listener)

This method is defined by Observable.

### destroy

`public function destroy()`
Destroys this panel
Parameters:

- None.

Returns:

- `void`

This method is defined by ContentPanel.

### 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.

### getEl

`public function getEl()`
Returns this panel's element
Parameters:

- None.

Returns:

- `YAHOO.ext.Element`

This method is defined by ContentPanel.

### getId

`public function getId()`
Returns this panel's id
Parameters:

- None.

Returns:

- `String`

This method is defined by ContentPanel.

### getTitle

`public function getTitle()`
Returns this panel's title
Parameters:

- None.

Returns:

- `String`

This method is defined by ContentPanel.

### getToolbar

`public function getToolbar()`
Returns the toolbar for this Panel if one was configured
Parameters:

- None.

Returns:

- `YAHOO.ext.Toolbar`

This method is defined by ContentPanel.

### getUpdateManager

`public function getUpdateManager()`
Get the YAHOO.ext.UpdateManager for this panel. Enables you to perform Ajax updates.
Parameters:

- None.

Returns:

- `YAHOO.ext.UpdateManager`
  The UpdateManager

This method is defined by ContentPanel.

### isClosable

`public function isClosable()`
Returns true is this panel was configured to be closable
Parameters:

- None.

Returns:

- `Boolean`

This method is defined by ContentPanel.

### purgeListeners

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

- None.

Returns:

- `void`

This method is defined by Observable.

### 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`])`
Updates this panel's element
Parameters:

- `content` : String
  The new content
- `loadScripts` : Boolean
  (optional) true to look for and process scripts

Returns:

- `void`

This method is defined by ContentPanel.

### setTitle

`public function setTitle(`String title`)`
Set this panel's title
Parameters:

- `title` : String

Returns:

- `void`

This method is defined by ContentPanel.

### setUrl

`public function setUrl(`String/Function url`, [`String/Object params`], [`Boolean loadOnce`])`
Set a URL to be used to load the content for this panel.
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 YAHOO.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 panel is activated. (Defaults to false)

Returns:

- `YAHOO.ext.UpdateManager`
  The UpdateManager

This method is defined by ContentPanel.

## Event Details

### activate

`public event activate`
Fires when this panel is activated.
Subscribers will be called with the following parameters:

- `this` : YAHOO.ext.ContentPanel

This event is defined by ContentPanel.

### deactivate

`public event deactivate`
Fires when this panel is activated.
Subscribers will be called with the following parameters:

- `this` : YAHOO.ext.ContentPanel

This event is defined by ContentPanel.

Copyright © 2006 Jack Slocum. All rights reserved.