doColumnSearch: Server-side searching

View source: R/shiny.R

doColumnSearchR Documentation

Server-side searching

Description

doGlobalSearch() can be used to search a data frame given the search string typed by the user into the global search box of a datatable. doColumnSearch() does the same for a vector given the search string typed into a column filter. These functions are used internally by the default filter function passed to dataTableAjax(), allowing you to replicate the search results that server-side processing returns.

Usage

doColumnSearch(x, search_string, options = list())

doGlobalSearch(data, search_string, options = list())

Arguments

x

a vector, the type of which determines the expected search_string format

search_string

a string that determines what to search for. The format depends on the type of input, matching what a user would type in the associated filter control.

options

a list of options used to control how searching character values works. Supported options are regex, caseInsensitive and (for global search) smart.

data

a data frame

Value

An integer vector of filtered row indices

See Also

The column filters section online for search string formats: https://rstudio.github.io/DT/

Accessing the search strings typed by a user in a Shiny app: https://rstudio.github.io/DT/shiny.html

Examples

doGlobalSearch(iris, "versi")
doGlobalSearch(iris, "v.r.i", options = list(regex = TRUE))

doColumnSearch(iris$Species, "[\"versicolor\"]")
doColumnSearch(iris$Sepal.Length, "4 ... 5")

DT documentation built on May 11, 2022, 1:09 a.m.