JSDoc: Class: Cell

# Class: Cell

## FooTable.Cell

#### new Cell(table, row, column, valueOrElement) → {FooTable.Cell}

The cell class containing all the properties for cells.

##### This:

- FooTable.Cell

##### Parameters:

Name | Type | Description
--- | --- | ---
`table` | FooTable.Table | The root `FooTable.Table` this cell belongs to.
`row` | FooTable.Row | The parent `FooTable.Row` this cell belongs to.
`column` | FooTable.Column | The `FooTable.Column` this cell falls under.
`valueOrElement` | * | HTMLElement | jQuery | Either the value or the element for the cell.

##### Returns:

Type
  FooTable.Cell

### Extends

- FooTable.Class

### Members

#### $detail :jQuery

The jQuery row object that represents this cell in the details table.

##### Type:

- jQuery

#### $el :jQuery

The jQuery table cell object this instance wraps.

##### Type:

- jQuery

#### (protected) classes :Array.<string>

An array of CSS classes for the cell.

##### Type:

- Array.<string>

#### (readonly) column :FooTable.Column

The `FooTable.Column` this cell falls under.

##### Type:

- FooTable.Column

#### (readonly) ft :FooTable.Table

The root `FooTable.Table` for the cell.

##### Type:

- FooTable.Table

#### o :object

Contains any options for the cell. These are the options supplied through the plugin constructor as part of the row object itself.

##### Type:

- object

#### (readonly) row :FooTable.Row

The parent `FooTable.Row` for the cell.

##### Type:

- FooTable.Row

#### (protected) style :object

The inline styles for the cell.

##### Type:

- object

#### value :*

The value of the cell.

##### Type:

- *

### Methods

#### (protected) $create()

After the cell has been defined this ensures that the $el and #detail properties are jQuery objects by either creating or updating them.

##### This:

- FooTable.Cell

#### (protected) collapse()

Collapses this cell and displays it in the details row.

#### (protected) define(valueOrElement)

This is supplied either the value or the cell element/jQuery object if it exists. If supplied the element we need set the $el property and parse the value from it.

##### This:

- FooTable.Cell

##### Parameters:

Name | Type | Description
--- | --- | ---
`valueOrElement` | * | jQuery | The value or element to define the cell.

#### (protected) format(value) → {string|HTMLElement|jQuery}

Helper method to call this cell's column formatter function using the supplied value and any additional required parameters.

##### This:

- FooTable.Cell

##### Parameters:

Name | Type | Description
--- | --- | ---
`value` | * | The value to format.

See:
  - FooTable.Column#formatter

##### Returns:

Type
  string | HTMLElement | jQuery

#### (protected) parse() → {*}

Helper method to call this cell's column parser function supplying the required parameters.

##### This:

- FooTable.Cell

See:
  - FooTable.Column#parser

##### Returns:

Type
  *

#### (protected) restore()

Restores this cell from a detail row back into the normal row.

#### val(valueopt, redrawopt) → {*|undefined}

Allows easy access to getting or setting the cell's value. If the value is set all associated properties are also updated along with the actual element. Using this method also allows us to supply an object containing options and the value for the cell.

##### This:

- FooTable.Cell

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`value` | * | <optional> |  | The value to set for the cell. If not supplied the current value of the cell is returned.
`redraw` | boolean | <optional> | true | Whether or not to redraw the row once the value has been set.

##### Returns:

Type
  * | undefined