-
-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
- It is possible, when auto-generating tables, to have a table with 1 (or more) header rows, 1 (or more) footer rows, and zero main rows in the table.
<thead>
<tr>...</tr>
</thead>
<tfoot>
<tr>...</tr>
</tfoot>
-
If the table contains an explicit
<tbody></tbody>section, then sorttable handles it fine. -
But in the usual case, where the
<tbody>tags are omitted (because they are considered implicit) AND the table has no main rows (i.e. there are no<tr>that come after<thead>and before<tfoot>), then sorttable complains and generates JS errors. -
The fix is to add the following, in makeSortable, just after the test for table.tHead == null:
//If there is no table body (no <tbody>, nor is it implicit because of a normal <tr>), then give up. Otherwise, we get errors later.
if (table.getElementsByTagName('tbody').length == 0){
//console.log ("disembodied table.");
return;
}
Metadata
Metadata
Assignees
Labels
No labels