reactable
reactable copied to clipboard
Data list filter not working in R Shiny
Hi There,
I tried to include the data list filter option for my reactable in my R Shiny application and I keep getting the following error.
Warning in renderWidget(instance) : Ignoring explicitly provided widget ID "network-table"; Shiny doesn't use them
. I just copied/pasted the code from the examples page. Can someone please help me solve this?
Thanks!
AT
Hi, if your table is a Shiny output rendered via renderReactable()
, you'll have to use the Shiny output ID as the unique table ID, rather than the reactable(elementId = "...")
argument. So to convert that example to be used for a Shiny output:
- Remove the
reactable(elementId = "network-table")
argument - In
dataListFilter("network-table")
, replace the table ID"network-table"
with the Shiny output ID (e.g., foroutput$table <- reactableOutput(...)
, the Shiny output ID would be"table"
).
There's a better explanation of this in the Using the JavaScript API docs.
The examples in the Custom Filtering docs are all done as static widgets outside of Shiny, so I'm thinking of adding notes that explain how to adapt the examples for Shiny, to make this less confusing. It may also be possible to provide a better warning message when elementId
is used in a Shiny output. That error comes from the htmlwidgets package, but reactable could possibly catch the same case and explain how to fix the warning.
Unfortunately, this solution does not work for my app :( not sure why.
Can you post a minimal, reproducible example of the app?