# Class: CollapsiblePanel

## RichFaces.ui. CollapsiblePanel

#### new CollapsiblePanel(componentId, options)

Backing object for rich:collapsiblePanel

##### Parameters:

Name | Type | Description
--- | --- | ---
`componentId` | string | component id
`options` | Object | params

Source:
  - collapsiblePanel.js, line 41

### Extends

- RichFaces.ui.TogglePanel

### Members

#### name :string

Component name.

##### Type:

- string

Inherited From:
  - RichFaces.BaseComponent#name
Source:
  - richfaces-base-component.js, line 195

### Methods

#### attachToDom(source) → {DOMElement}

Attach component object to DOM element by component id, DOM element or jQuery object and returns the element Its required for the client side API calls and to clean up after ajax request or document unload by calling destroy method

##### Parameters:

Name | Type | Description
--- | --- | ---
`source` | string | DOMElement | jQuery | component id, DOM element or DOM elements wrapped by jQuery

Inherited From:
  - RichFaces.BaseComponent#attachToDom
Source:
  - richfaces-base-component.js, line 237

##### Returns:

Type
  DOMElement

#### collapse()

Collapse the panel

Source:
  - collapsiblePanel.js, line 83

#### destroy()

Destroy method. Will be called before remove component from the page

Inherited From:
  - RichFaces.BaseComponent#destroy
Source:
  - richfaces-base-component.js, line 313

#### detach(source)

Detach component object from DOM element by component id, DOM element or jQuery object

##### Parameters:

Name | Type | Description
--- | --- | ---
`source` | string | DOMElement | jQuery | component id, DOM element or DOM elements wrapped by jQuery

Inherited From:
  - RichFaces.BaseComponent#detach
Source:
  - richfaces-base-component.js, line 258

#### expand()

Expand the panel

Source:
  - collapsiblePanel.js, line 73

#### firstItem() → {string}

Get the name of the first item

Inherited From:
  - RichFaces.ui.TogglePanel#firstItem
Source:
  - togglePanel.js, line 292

##### Returns:

name of first panel item

Type
  string

#### getEventElement() → {string}

Method returns element's id for event handlers binding. Event API calls this method when binding by component object as selector was used.

Inherited From:
  - RichFaces.BaseComponent#getEventElement
Source:
  - richfaces-base-component.js, line 224

##### Returns:

Type
  string

#### getItems() → {Array.<TogglePanelItem>}

Get all items

Inherited From:
  - RichFaces.ui.TogglePanel#getItems
Source:
  - togglePanel.js, line 245

##### Returns:

all defined panel items

Type
  Array.<TogglePanelItem>

#### getItemsNames() → {Array.<string>}

Get names of items

Inherited From:
  - RichFaces.ui.TogglePanel#getItemsNames
Source:
  - togglePanel.js, line 257

##### Returns:

names of all defined items

Type
  Array.<string>

#### getNextItem(name) → {TogglePanelItem}

Get the next item after given name

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | name of TogglePanelItem or meta name (@first | @prev | @next | @last)

Inherited From:
  - RichFaces.ui.TogglePanel#getNextItem
Source:
  - togglePanel.js, line 210

##### Returns:

null if item not found

Type
  TogglePanelItem

#### getSelectedItem() → {string}

Inherited From:
  - RichFaces.ui.TogglePanel#getSelectedItem
Source:
  - togglePanel.js, line 172

##### Returns:

name of current selected panel item

Type
  string

#### invokeEvent(eventType, element, event, data) → {boolean}

Invokes event on on the DOM element

##### Parameters:

Name | Type | Description
--- | --- | ---
`eventType` | string | event type, e.g. "click"
`element` | DOMElement | DOM element object
`event` | Event | jQuery Event
`data` | Object | additional data used for event handler

Inherited From:
  - RichFaces.BaseComponent#invokeEvent
Source:
  - richfaces-base-component.js, line 272

##### Returns:

true if an event is successfully invoked

Type
  boolean

#### isExpanded() → {boolean}

Returns true if the panel is expanded

Source:
  - collapsiblePanel.js, line 93

##### Returns:

true if the panel is expanded

Type
  boolean

#### lastItem() → {string}

Get the name of the last item

Inherited From:
  - RichFaces.ui.TogglePanel#lastItem
Source:
  - togglePanel.js, line 304

##### Returns:

name of last panel item

Type
  string

#### nextItem(iteName) → {string}

Get the name of the next item

##### Parameters:

Name | Type | Description
--- | --- | ---
`iteName` | string | name of the item for which the next is computed

Inherited From:
  - RichFaces.ui.TogglePanel#nextItem
Source:
  - togglePanel.js, line 274

##### Returns:

name of next panel item

Type
  string

#### switchPanel(toopt)

Switch the state of the panel

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`to` | string | <optional> | state to switch to: "true" (expanded), "false" (collapsed), "@next"

Source:
  - collapsiblePanel.js, line 62

#### switchToItem(name) → {Boolean}

Switch to a new item

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | panel item name to switch we can use meta names @first, @prev, @next and @last

Inherited From:
  - RichFaces.ui.TogglePanel#switchToItem
Source:
  - togglePanel.js, line 182

##### Returns:

- false if something wrong and true if all is ok

Type
  Boolean

#### toString() → {string}

Method for converting object to string

Inherited From:
  - RichFaces.BaseComponent#toString
Source:
  - richfaces-base-component.js, line 203

##### Returns:

Type
  string