Class: Table

Table

Templates and creates tables

Constructor

new Table(options)

Constructor
Parameters:
Name Type Description
options object
Properties
Name Type Description
rowHeaders Array.<string> if using the default table template, pass a string array of row headers
struct object
Properties
Name Type Description
$wrapper string css class of the table
$thead string css class of the header
$tbody string css class of the body
$tfoot string css class of the footer
$tr string css class of the row
Source:

Extends

  • Template

Methods

addRow(data) → {Table}

Add a new row and populate with data
Parameters:
Name Type Description
data object
Source:
Returns:
Type
Table

appendRow($row) → {Table}

Add the row to the
Parameters:
Name Type Description
$row jQuery
Source:
Returns:
Type
Table

build(data) → {Table}

Build the entire table
Parameters:
Name Type Description
data object | Array.<object> object: an object of objects, where each object is a row of data All row objects are name-value pairs, where the names equal a [name] or [data-name] attribute within a row DOM element object[]: same as object, but instead an object of objects, it is an array of objects array: an array of data. This is the most simplest form of data and will simply be turned into s with the data as the html
Source:
Returns:
Type
Table

createRow() → {jQuery}

Create a new row
Source:
Returns:
Type
jQuery

deleteRow(index) → {Table}

Delete a row based on its index in this.$tr
Parameters:
Name Type Description
index number
Source:
Returns:
Type
Table

populateRow($row, data) → {Table}

Populate a row with data The elements will be populated
Parameters:
Name Type Description
$row jQuery row to populate
data Array.<object> array of data
Source:
Returns:
Type
Table

toggleEmpty(stateopt) → {Table}

Toggle the empty table message and hide the thead and tfoot
Parameters:
Name Type Attributes Default Description
state boolean <optional>
true
Source:
Returns:
Type
Table

wipe() → {Table}

Empty the and the cached data
Source:
Returns:
Type
Table