Print Friendly

# Class YAHOO.ext.grid.AbstractColumnModel

Package: | YAHOO.ext.grid
Class: | AbstractColumnModel
Extends: | Observable
Subclasses: | DefaultColumnModel
Defined In: | AbstractColumnModel.js

This abstract class defines the ColumnModel interface and provides default implementations of the events required by the Grid.

## Public Properties

This class has no public properties.

## Public Methods

Method | Defined By
--- | ---
| AbstractColumnModel() | AbstractColumnModel
| 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.
| fireEvent(`String eventName`, `Object... args`) : Boolean | Observable
Fires the specified event with the passed parameters (minus the event name).
| getColumnCount() : Number | AbstractColumnModel
Interface method - Returns the number of columns.
| getColumnHeader(`Number col`) : String | AbstractColumnModel
Interface method - Returns the header for the specified column.
| getColumnWidth(`Number col`) : Number | AbstractColumnModel
Interface method - Returns the width for the specified column.
| getRenderer(`Number col`) : Function | AbstractColumnModel
Interface method - Returns the rendering (formatting) function defined for the column.
| getSortType(`Number col`) : Function | AbstractColumnModel
Interface method - Returns the sorting comparison function defined for the column (defaults to sortTypes.none).
| getTotalWidth() : Number | AbstractColumnModel
Interface method - Returns the total width of all columns.
| isHidden(`Number col`) : Boolean | AbstractColumnModel
Interface method - Returns true if the specified column is hidden.
| isSortable(`Number col`) : Boolean | AbstractColumnModel
Interface method - Returns true if the specified column is sortable.
| purgeListeners() : void | Observable
Removes all listeners for this object
| removeListener(`String eventName`, `Function handler`, [`Object scope`]) : void | Observable
Removes a listener

## Public Events

Event | Defined By
--- | ---
| headerchange : (`ColumnModel this`, `Number columnIndex`, `Number newText`) | AbstractColumnModel
Fires when the text of a header changes
| hiddenchange : (`ColumnModel this`, `Number columnIndex`, `Number hidden`) | AbstractColumnModel
Fires when a column is hidden or "unhidden"
| widthchange : (`ColumnModel this`, `Number columnIndex`, `Number newWidth`) | AbstractColumnModel
Fires when the width of a column changes

## Constructor Details

### AbstractColumnModel

`public function AbstractColumnModel()`
Parameters:

- None.

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

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

### getColumnCount

`public function getColumnCount()`
Interface method - Returns the number of columns.
Parameters:

- None.

Returns:

- `Number`

This method is defined by AbstractColumnModel.

### getColumnHeader

`public function getColumnHeader(`Number col`)`
Interface method - Returns the header for the specified column.
Parameters:

- `col` : Number
  The column index

Returns:

- `String`

This method is defined by AbstractColumnModel.

### getColumnWidth

`public function getColumnWidth(`Number col`)`
Interface method - Returns the width for the specified column.
Parameters:

- `col` : Number
  The column index

Returns:

- `Number`

This method is defined by AbstractColumnModel.

### getRenderer

`public function getRenderer(`Number col`)`
Interface method - Returns the rendering (formatting) function defined for the column.
Parameters:

- `col` : Number
  The column index

Returns:

- `Function`

This method is defined by AbstractColumnModel.

### getSortType

`public function getSortType(`Number col`)`
Interface method - Returns the sorting comparison function defined for the column (defaults to sortTypes.none).
Parameters:

- `col` : Number
  The column index

Returns:

- `Function`

This method is defined by AbstractColumnModel.

### getTotalWidth

`public function getTotalWidth()`
Interface method - Returns the total width of all columns.
Parameters:

- None.

Returns:

- `Number`

This method is defined by AbstractColumnModel.

### isHidden

`public function isHidden(`Number col`)`
Interface method - Returns true if the specified column is hidden.
Parameters:

- `col` : Number
  The column index

Returns:

- `Boolean`

This method is defined by AbstractColumnModel.

### isSortable

`public function isSortable(`Number col`)`
Interface method - Returns true if the specified column is sortable.
Parameters:

- `col` : Number
  The column index

Returns:

- `Boolean`

This method is defined by AbstractColumnModel.

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

## Event Details

### headerchange

`public event headerchange`
Fires when the text of a header changes
Subscribers will be called with the following parameters:

- `this` : ColumnModel
- `columnIndex` : Number
  The column index
- `newText` : Number
  The new header text

This event is defined by AbstractColumnModel.

### hiddenchange

`public event hiddenchange`
Fires when a column is hidden or "unhidden"
Subscribers will be called with the following parameters:

- `this` : ColumnModel
- `columnIndex` : Number
  The column index
- `hidden` : Number
  true if hidden, false otherwise

This event is defined by AbstractColumnModel.

### widthchange

`public event widthchange`
Fires when the width of a column changes
Subscribers will be called with the following parameters:

- `this` : ColumnModel
- `columnIndex` : Number
  The column index
- `newWidth` : Number
  The new width

This event is defined by AbstractColumnModel.

Copyright © 2006 Jack Slocum. All rights reserved.