reactable icon indicating copy to clipboard operation
reactable copied to clipboard

Data list filter not working in R Shiny

Open ayeTown opened this issue 2 years ago • 3 comments

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

ayeTown avatar Aug 25 '22 21:08 ayeTown

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:

  1. Remove the reactable(elementId = "network-table") argument
  2. In dataListFilter("network-table"), replace the table ID "network-table" with the Shiny output ID (e.g., for output$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.

glin avatar Aug 28 '22 23:08 glin

Unfortunately, this solution does not work for my app :( not sure why.

ayeTown avatar Sep 19 '22 01:09 ayeTown

Can you post a minimal, reproducible example of the app?

glin avatar Sep 19 '22 05:09 glin