Skip to contents

Set header filter

Usage

set_header_filter(
  widget,
  columns,
  type = c("input", "number", "list", "tickCross"),
  func = c("like", "=", ">", ">=", "<", "<="),
  values_lookup = TRUE,
  clearable = TRUE,
  placeholder = NULL
)

Arguments

widget

A tabulator() HTML widget.

columns

The names of the columns the formatter is applied to.

type

(character): The type of the filter.

func

(character): The filter function.

values_lookup

(bool): Whether to use unique column values for the list filter.

clearable

(bool): Whether to display a cross to clear the filter.

placeholder

(character): Text that is displayed when no filter is set.

Value

The updated tabulator() HTML widget

Examples

data <- data.frame(
  age = c(10, 20, 40),
  first_name = c("Franz", "Ferdinand", "Julia"),
  last_name = c("Young", "Bowie", "Blackey")
)

tabulator(data) |>
  set_header_filter("age", type = NULL, func = "<=", placeholder = "max age") |>
  set_header_filter("first_name", placeholder = "Fran") |>
  set_header_filter("last_name", type = "list")