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
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:
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:
-
<private> _onToggle(e)
-
Handles the toggle click event for rows.
This:
Parameters:
Name Type Description e
jQuery.Event The jQuery.Event object for the click event. -
collapse(setExpanded)
-
Sets the current row to a collapsed state removing the detail row if it exists.
Parameters:
Name Type Argument Description setExpanded
boolean <optional>
Whether or not to set the FooTable.Row#expanded property to false. Fires:
-
<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:
Returns:
- Type
- Array.<FooTable.Cell>
-
draw()
-
Draws the current row and cells.
This:
-
expand()
-
Sets the current row to an expanded state displaying any hidden columns in a detail row just below it.
Fires:
-
predraw(detach)
-
Prior to drawing this moves the details contents back to there original cells and detaches the toggle element from the row.
This:
Parameters:
Name Type Argument Description detach
boolean <optional>
Whether or not to detach the row. -
toggle()
-
Toggles the row between it's expanded and collapsed state if there are hidden columns.
This:
-
val(data, redraw, redrawSelf) → {*|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 Argument Default Description data
object <optional>
The data to set for the row. If not supplied the current value of the row is returned. redraw
boolean <optional>
true Whether or not to redraw the table once the value has been set. redrawSelf
boolean <optional>
true Whether or not to redraw the row itself once the value has been set, if `false` this will override the supplied `redraw` value and prevent the table from redrawing as well. Returns:
- Type
- * | undefined