Adds stripes to an instance of HtmlTable.
Refactors
Syntax
new HtmlTable([table, options]);
Arguments
- table - (mixed; optional) - a Table DOM element or it's id; if you do not specify one, one will be created.
- options - (object; optional) a key/value set of options.
Options
- all options defined by HtmlTable, plus:
- classZebra - (string) the class added to odd numbered rows; defaults to 'table-tr-odd'
- zebra - (boolean) if true adds the classZebra value to odd numbered rows.
Example
var myTable = new HtmlTable({
properties: {
border: 1,
cellspacing: 3
},
rows: [
['apple', 'red'],
['lemon', 'yellow']
],
zebra: true
});
myTable.inject($('someContainer'));
Updates the rows, reapplying the odd class names.
Syntax
myHtmlTable.updateZebras();
Returns
- (object) an object containing the tr and td tags.
Example of Object Returned
{tr: theTableRow, tds: [td, td, td]}
Empties the tbody of the table.
Syntax
myTable.empty();
Returns
- (object) This instance of HtmlTable.
Sets the contents of the thead with th tags.
Syntax
myTable.setHeaders(headers);
Arguments
- headers - (array) an array of header information; same as the row data sent to HtmlTable.push
Returns
- (object) This instance of HtmlTable.