doesn’t work with table block?
-
Hey! This plugin is such a simple solution for table sorting!
However, it doesn’t seem to work with the TABLE BLOCK generated by the new standard WordPress block editor (aka Gutenberg)?
The reason being… the TABLE BLOCK inserts a <figure> which has <table> nested inside it.
Example:
<figure class="wp-block-table tablesorter"><table class="has-fixed-layout"><thead><tr><th>head</th><th>head2</th></tr></thead><tbody><tr><td>alpha</td><td>bet</td></tr><tr><td>bet</td><td>alpha</td></tr></tbody></table></figure>So when the user tries to add “tablesorter” class to the Advanced sidebar for the block, the block editor interface adds this class to the FIGURE and not the TABLE.
I tried adding this class manually via the Code Editor and it broke the block.
Any simple way to get this plugin working with the block editor as well? Perhaps your PHP could also look for Figure > Table and achieve the same outcome?
Thank you!
—
UPDATE: I changed some CSS & elements in your plugin and it seems to work. Any way you can confirm and incorporate this as an alternate?
IN CSS: Changed all references to table.tablesorter to figure.tablesorter>table
IN jquery.tableshorter.js: Change all references at top to (‘figure>table’).tablesorter()
Then the only catch is that there is no way to add “sortless” to TH since adding it in the block code editor also breaks the block 🙁
The topic ‘doesn’t work with table block?’ is closed to new replies.