sanvica
sanvica

Reputation: 99

Sorting table by clicking on cell in another table

I have two HTML tables. One contains only the header cells, the other has the data. I have it this way so the header row remains in place while scrolling the data table.

How can I sort the data table by clicking the header table? I want to click the cell in the header table and have the other table sort by the same column.

I assume this will require Javascript.

Upvotes: 1

Views: 63

Answers (1)

serraosays
serraosays

Reputation: 7869

You can make a table header fixed in place without placing it into a separate table. In fact, this is required if you want someone with a screenreader to be able to actually navigate the table.

Check out jQuery.floatThead - does exactly what you are looking for. See Demo here.

Upvotes: 1

Related Questions