You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello and thanks for the great work on this package! It works fantastically well.
I was trying to improve an exisitng Rmarkdown HTML report by including interactive filtering for a table which contains a sub-table nested in the detail section of each row.
With this code, the filter widget successfully filters any subtables that are currently expanded as the value in the filter is changed. However my attempt to filter a subtable as soon as it is expanded using htmlwidgets::onRender and a hardcoded default value does not seem to work. I'm not sure how to successfully achieve this though, does anyone have any ideas?
Secondly, assuming I can get the filtering to work on a subtable as soon as it expands, how would I go about referencing the current value of the filter widget rather than a hardcoded value? I don't know enough about JS and React to properly understand how it all fits together, but from some googling it seems I would maybe need to make use of the React useRef hook?
The text was updated successfully, but these errors were encountered:
Hi, I can't think of any good way to do either unfortunately. In general, nested subtables are really hard to do state-ful things with because they're only created on details expansion, and then destroyed on details collapse or page change. Getting filter state to persist with these changes will be really tough.
For the first issue, it's probably another good reason to add a default table filter state (related: #326), so you don't have to hack it in via JavaScript. Using htmlwidgets::onRender() would usually work, but I think it doesn't work here because it's not supported by how reactable renders custom HTML.
For now, I could only suggest figuring out a different way to achieve this that doesn't use nested subtables, e.g. a Shiny app with a selectable table, where row selections will render the details table in a separate panel. Of course this is completely different being a Shiny app rather than a static doc, but just one idea that I think would actually work.
Hello and thanks for the great work on this package! It works fantastically well.
I was trying to improve an exisitng Rmarkdown HTML report by including interactive filtering for a table which contains a sub-table nested in the
detail
section of each row.Here is some example code:
With this code, the filter widget successfully filters any subtables that are currently expanded as the value in the filter is changed. However my attempt to filter a subtable as soon as it is expanded using
htmlwidgets::onRender
and a hardcoded default value does not seem to work. I'm not sure how to successfully achieve this though, does anyone have any ideas?Secondly, assuming I can get the filtering to work on a subtable as soon as it expands, how would I go about referencing the current value of the filter widget rather than a hardcoded value? I don't know enough about JS and React to properly understand how it all fits together, but from some googling it seems I would maybe need to make use of the React
useRef
hook?The text was updated successfully, but these errors were encountered: