glin/reactable

use multiple elementids in the same reactable

micboat opened this issue · 2 comments

Is it possible to add multiple elementids. Example for filter input and download button like this:
table <- reactable(
df,
columns = list(
Group Indicator = colDef(
filterInput = function(values, name) {
tags$select(
onchange = sprintf("Reactable.setFilter('grp-select', '%s', event.target.value || undefined)", name),
tags$option(value = "", "All"),
lapply(unique(values), tags$option),
"aria-label" = sprintf("Filter %s", name),
style = "width: 100%; height: 28px;"
)
}
), elementId = c("grp-select","df_name")
)

htmltools::browsable(
  htmltools::tagList(
    csvDownloadButton("df_name", "Download as CSV", filename = "Ratios.csv"),
    table
  )
)

It currently supports only one elementId

glin commented

Hi, that's not possible, each table can only have one unique ID. Is there any reason why both the filter and download buttons couldn't use the same table ID?

I can manage that with one ID. Thanks for the quick response & thanks for creating this tool. Very useful