Print Friendly

# Class YAHOO.ext.Toolbar

Package: | YAHOO.ext
Class: | Toolbar
Extends: | Object
Defined In: | Toolbar.js

Basic Toolbar used by the Grid to create the paging toolbar. This class is reusable but functionality is limited. Look for more functionality in a future version.

## Public Properties

This class has no public properties.

## Public Methods

Method | Defined By
--- | ---
| Toolbar(`String/HTMLElement/Element container`, [`Array buttons`]) | Toolbar
| add(`Mixed arg`) : void | Toolbar
Adds element(s) to the toolbar - this function takes a variable number of arguments of mixed type and adds them to t...
| addButton(`Object/Array config`) : YAHOO.ext.ToolbarButton/Array | Toolbar
Add a button (or buttons), see YAHOO.ext.ToolbarButton for more info on the config
| addSeparator() : void | Toolbar
Adds a separator
| addText(`String text`) : HTMLElement | Toolbar
Adds text to the toolbar
| getEl() : YAHOO.ext.Element | Toolbar
Returns the element for this toolbar
| insertButton(`Number index`, `Object/Array config`) : YAHOO.ext.ToolbarButton/Array | Toolbar
Inserts a button (or buttons) at the specified index

## Public Events

This class has no public events.

## Constructor Details

### Toolbar

`public function Toolbar(`String/HTMLElement/Element container`, [`Array buttons`])`
Parameters:

- `container` : String/HTMLElement/Element
- `buttons` : Array
  (optional) array of button configs or elements to add

## Method Details

### add

`public function add(`Mixed arg`)`
Adds element(s) to the toolbar - this function takes a variable number of arguments of mixed type and adds them to the toolbar...
Parameters:

- `arg` : Mixed
  If arg is a ToolbarButton, it is added. If arg is a string, it is wrapped in a ytb-text element and added unless the text is "separator" in which case a separator is added. Otherwise, it is assumed the element is an HTMLElement and it is added directly.

Returns:

- `void`

This method is defined by Toolbar.

### addButton

`public function addButton(`Object/Array config`)`
Add a button (or buttons), see YAHOO.ext.ToolbarButton for more info on the config
Parameters:

- `config` : Object/Array
  A button config or array of configs

Returns:

- `YAHOO.ext.ToolbarButton/Array`

This method is defined by Toolbar.

### addSeparator

`public function addSeparator()`
Adds a separator
Parameters:

- None.

Returns:

- `void`

This method is defined by Toolbar.

### addText

`public function addText(`String text`)`
Adds text to the toolbar
Parameters:

- `text` : String
  The text to add

Returns:

- `HTMLElement`
  The span element created which you can use to update the text.

This method is defined by Toolbar.

### getEl

`public function getEl()`
Returns the element for this toolbar
Parameters:

- None.

Returns:

- `YAHOO.ext.Element`

This method is defined by Toolbar.

### insertButton

`public function insertButton(`Number index`, `Object/Array config`)`
Inserts a button (or buttons) at the specified index
Parameters:

- `index` : Number
  The index where the buttons are to be inserted
- `config` : Object/Array
  A button config or array of configs

Returns:

- `YAHOO.ext.ToolbarButton/Array`

This method is defined by Toolbar.

yui-ext - Copyright © 2006 Jack Slocum. | Yahoo! UI - Copyright © 2006 Yahoo! Inc.
All rights reserved.