jQuery XTable
Introduction
XTable provides a table selection API for HTML tables on top of jQuery. XTable augments the base jQuery object with a table function. The developer can use this table function to construct a XTable object. Via the XTable object, the developer can access XTable methods in addition to standard jQuery ones.
License | Supported Platforms | Table selectors | User selection
Summary
For example:
var obj = $
gives you access to a suite XTable methods. These methods include:
- base/basis - set/return the origin for coordinate mapping
- row/xrow - select a row by passing in the row number
- column/xcolumn - select a column by passing in the column label
- cell/xcell - select a cell by passing in the cell label
Examples
Styling
To set the background color of cells in row 2 to red:
$;
To set the text color of cells of A1 to D2 to blue:
$;
Find the title element in cell A1 and hide it:
$;
Data Extraction
To get the text of the first row:
$text
To get the text of the A1 cell:
$text;
To get the value of the A1 cell:
$value;
Statistics
To sum column D in table.mlb:
$
To calculate the average of column D in table.mlb:
$
Coordinate Remapping
Remap coordinates by skipping the first header row. Retrieve the value of the A1 cell with the new coordinate mapping.
$value
Remap coordinates by skipping the first header row and first header column. Retrieve the value of the A1 cell with the new coordinate mapping.
$value
User Selection
To enable user selection:
$;
To get cells selected by user:
$selection