TableBlock does not render
unexceptable opened this issue · 8 comments
We use:
https://docs.wagtail.io/en/v2.2.1/reference/contrib/table_block.html
Testing with this Streamfield and the block doesn't render the table editor.
Indeed. I thought it worked because adding a new block works, but turns out it doesn’t fully work with an existing value.
In fact it’s an issue coming from Handsontable that does not correctly render tables inside collapsible. We have exactly the same issue with tabs in Wagtail, see wagtail/wagtail#2687.
I’ll try making a fix for this as well as the tabs issue.
OK, Handsontable is really annoying, I’m considering removing it from Wagtail… It just doesn’t render anything if the HTML is not visible, and even with workarounds, the results are partially broken.
I thought updating Handsontable from 0.24.2 to 5.0.1 (!) would fix it, but absolutely not. Nothing changes.
I’ll apply the awful fix recommended by the official pro team of Handsontable: re-instantiate the table every time someone opens a block. Terrible.
Is there an alternative to Handsontable? I looked but all the other options look worse.
Same here, I couldn’t find a good alternative to Handsontable…
However, by cleaning and reworking some of the JavaScript from react-streamfield, I made it fully work, including duplication!
So fixed by wagtail-deprecated/react-streamfield@ba91231. Will be in wagtail-react-streamfield shortly.
Fix released in 0.8.3.
Similar issue with last versions of wagtail and wagtail-react-streamfield
A new table is correctly displayed in the editor but not a previously saved one.
In chrome if you attempt to inspect the element with inspector it's miraculously displayed (no with firefox). It seams that some javascritpt init is missing somewhere.
I investigated more...
In fact the issue comes from the closed attribute of wagtail-react-streamfield that I always set to True in order to have something readable. If the table block streamfield or one of its parent streamfield has the closed attibute set, the table data is not displayed when rendering the page in admin so the height calculation of the table data is not correct when you open the table field.
In order to reproduce, juste create a table block streamfield with the closed attribute set.
I think some kind of event is necesssary to calculate the height of the table data when react-streamfield opens the item.