JSDoc: Class: Row

# Class: Row

## FooTable.Row

#### new Row(table, columns, dataOrElement) → {FooTable.Row}

The row class containing all the properties for a row and its' cells.

##### Parameters:

Name | Type | Description
--- | --- | ---
`table` | FooTable.Table | The parent `FooTable.Table` this component belongs to.
`columns` | Array.<FooTable.Column> | The array of `FooTable.Column` for this row.
`dataOrElement` | * | HTMLElement | jQuery | Either the data for the row (create) or the element (parse) for the row.

##### Returns:

Type
  FooTable.Row

### Extends

- FooTable.Class

### Members

#### columns :Array.<FooTable.Column>

The array of `FooTable.Column` for this row.

##### Type:

- Array.<FooTable.Column>

#### ft :FooTable.Table

The `FooTable.Table` for the row.

##### Type:

- FooTable.Table

### Methods

#### (static) define(dataOrElement)

This is supplied either the object containing the values for the row or the row element/jQuery object if it exists. If supplied the element we need to set the $el property and parse the cells from it using the column index. If we have an object we parse the cells from it using the column name.

##### Parameters:

Name | Type | Description
--- | --- | ---
`dataOrElement` | object | jQuery | The row object or element to define the row.

#### (protected) $create()

After the row has been defined this ensures that the $el property is a jQuery object by either creating or updating the current value.

##### This:

- FooTable.Row

#### (private) _onToggle(e)

Handles the toggle click event for rows.

##### This:

- jQuery

##### Parameters:

Name | Type | Description
--- | --- | ---
`e` | jQuery.Event | The jQuery.Event object for the click event.

#### collapse()

Sets the current row to a collapsed state removing the detail row if it exists.

##### This:

- FooTable.Row

#### (protected) createCells() → {Array.<FooTable.Cell>}

This is called during the construct method and uses the current column definitions to create an array of `FooTable.Cell` objects for the row.

##### This:

- FooTable.Row

##### Returns:

Type
  Array.<FooTable.Cell>

#### draw()

Draws the current row and cells.

##### This:

- FooTable.Row

#### expand()

Sets the current row to an expanded state displaying any hidden columns in a detail row just below it.

##### Fires:

- FooTable.event:Row"expand.ft.row"

#### predraw()

Prior to drawing this moves the details contents back to there original cells and detaches the toggle element from the row.

##### This:

- FooTable.Row

#### toggle()

Toggles the row between it's expanded and collapsed state if there are hidden columns.

##### This:

- FooTable.Row

#### val(dataopt) → {*|undefined}

Allows easy access to getting or setting the row's data. If the data 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 data for the row at the same time.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`data` | object | <optional> | The data to set for the row. If not supplied the current value of the row is returned.

##### Returns:

Type
  * | undefined