filamentgroup / tablesaw

A group of plugins for responsive tables.
MIT License
5.48k stars 434 forks source link

Add support initially hiding or showing columns #245

Closed jgibson closed 7 years ago

jgibson commented 8 years ago

I needed to preserve the shown/hidden state of columns when using column toggle mode across table refreshes. This PR does so by adding a new data attribute, data-tablesaw-hidden. When set to true it will force the column to be initially hidden. When set to false it will ensure that the column is initially visible.

Other users have requested similar functionality (see #214 for example). This provides that functionality in a round-about way. I'm not sure if the data attribute method is the best approach to solve this issue, but it seemed to be in the same spirit as the rest of the declarative configuration attributes that Tablesaw employs.

These changes were originally made against the 2.x series and thus relied upon some jQuery functionality that hasn't been duplicated in Shoestring. I added a second test HTML file that executes the full test suite against the jQuery-version of the code. The final commit in the branch adjusts the code to be compatible with Shoestring.

nickalbrecht commented 8 years ago

Be nice if this could be persisted to LocalStorage or SessionStorage natively, that way they would be persisted against full page refreshes, and potentially even separate sessions as a user preference for common table display setups. But this would be useful to have :-)

zachleat commented 7 years ago

Sorry I didn’t get to this sooner—trying to clean up outdated PRs.

Please reopen if you’d like to discuss further.