# https://github.com/r-lib/pkgdown/issues/2704

Skip to contents

Function that returns a `reactable` filter input render function that provide a drop down functionality.

Usage

create_dropdown_filter_render_function(
  reactable_element_id,
  style = "width: 100%; height: 100%;"
)

Arguments

reactable_element_id

Text input indicating the element ID of the `reactable`

style

Text input indicating the javascript style parameters of the filter input drop down box. Default: 'width: 100%; height: 28px;'

Value

A render function for a `reactable` column indicating that it needs a drop down filter input box.

Examples

create_dropdown_filter_render_function(
  reactable_element_id = "drop-down-filter-table")
#> function (values, name) 
#> {
#>     htmltools::tags$select(onchange = sprintf("\n          const value = event.target.value\n          Reactable.setFilter('%s', '%s', value === '__ALL__' ? undefined : value)", 
#>         reactable_element_id, name), htmltools::tags$option(value = "__ALL__", 
#>         "All"), lapply(intersect(levels(values), unique(values)), 
#>         htmltools::tags$option), `aria-label` = sprintf("Filter %s", 
#>         name), style = style)
#> }
#> <bytecode: 0x5653b7fc9070>
#> <environment: 0x5653b7fca3b0>