filamentgroup / tablesaw

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

Add refresh event for tablesaw-stack #211

Closed Cybso closed 7 years ago

Cybso commented 8 years ago

Currently a refresh() event won't trigger an update to the table labels when new rows where added after initialization or the labels have changed.

The attached patch modifies Stack.prototype.init() so that column labels are only added if missing, and they will be updated. Additionally, the "tablesawrefresh" event is intercepted and will reexecute init().

tablesaw.stackonly.js_add-stack-refresh.patch.txt

Cybso commented 8 years ago

Updated the patch to modify the b's HTML content only when it differs. Otherwise refresh() couldn't be triggered by an MutationObserver because each update to the labels content would trigger another mutation event.

tablesaw.stackonly.js_add-stack-refresh.v2.patch.txt

zachleat commented 8 years ago

@Cybso Can you file this as a PR instead?