jchamet / html-table-sort

Chrome Extension. Add it to your browser to use. Clicking on a table column header <th> will reorder the rows of an HTML table in ascending/descending order.
MIT License
13 stars 9 forks source link

Feature/sort non header tables #17

Closed TorkelV closed 4 years ago

TorkelV commented 4 years ago

Support tables without headers

Fix #8 , and indirectly #16 .

If no TH exists in a table, search for TR instead, and assume that the first rows TD nodes are the headers.

Since many old webpages still use tables for design and we want to avoid adding onClick for things that are not data tables, I added an arbitrary restriction for tables without TH where we only sort them if they have more than 5 rows.

Add table cells to the tbody instead of the table.

Fix #12 Most tables include a tbody, but currently we sort and readd the rows to the table, instead of the body, which on many webpages breaks the design. Now we should correctly add cells to the tbody if it exists.