jennschiffer / timbles.js

a very simple jQuery plugin for tables, made by the person who literally did not invent tables
MIT License
38 stars 4 forks source link

Replace header-row class with sort-header-cell classes #36

Closed edelooff closed 8 years ago

edelooff commented 8 years ago

This PR replaces the header-row class with a sort-header class per header cell. This class is attached to those cells that actually have a sorting hook (cells marked no-sort will be excluded). This resolves #35.

To address @jennschiffer's comment in that issue:

That being said, I do think it's a good idea to make the names of things as semantically sound for future module add-ons. I think that columnHeader shouldn't just be restricted to sortable column headers, perhaps activeHeader would be a better class name

The data.$headerRow property is replaced with data.$headers, a jQuery object of column header cells. Future plugins that need to act on column headers should select them from this object. This way we have a maximally specific class for active table sorting headers, and also support future extension.

Tests have been updated to no longer check for the header row presence, but the expected count of sortHeader classes. Same thing with the non-header-row count, which was essentially a table-body rowcount. That one might even be completely superfluous by now.

jennschiffer commented 8 years ago

:+1: