A page has several tables on it that need to be enhanced into DataTables.
Create a static factory method DataTable.enhanceTable(tbl,config)
to encapsulate typical progressive enhancement cases. The function replaces the table
element with a div
assigned the same id
and class
attributes and uses that div as the new DataTable's container.
Caveats: The function has no column level configuration available. All columns are made sortable. Also, it is assumed that there are no nested column headers.
Foo | Bar | Baz |
---|---|---|
Foo 1 | Bar 1 | Baz 1 |
Foo 2 | Bar 2 | Baz 2 |
Foo 3 | Bar 3 | Baz 3 |
Foo 4 | Bar 4 | Baz 4 |
Foo 5 | Bar 5 | Baz 5 |
Color | Shape | Size |
---|---|---|
green | cube | small |
blue | sphere | medium |
purple | cone | small |
black | taurus | large |
red | pyramid | large |
Letter | Quantity | Score |
---|---|---|
(blank) | 2 | 0 |
A | 9 | 1 |
B | 2 | 3 |
C | 2 | 3 |
D | 4 | 2 |
E | 12 | 1 |
F | 2 | 4 |
G | 3 | 2 |
H | 2 | 4 |
I | 9 | 1 |
J | 1 | 8 |
K | 1 | 5 |
L | 4 | 1 |
M | 2 | 3 |
N | 6 | 1 |
O | 8 | 1 |
P | 2 | 3 |
Q | 1 | 10 |
R | 6 | 1 |
S | 4 | 1 |
T | 6 | 1 |
U | 4 | 1 |
V | 2 | 4 |
W | 2 | 4 |
X | 1 | 8 |
Y | 2 | 4 |
Z | 1 | 10 |