Skip to contents

Create a faketable column definition

Usage

col_def(name, input_call, cast, width, display_name = name, ...)

Arguments

name

The column name

input_call

A input_call() object

cast

A bare function call to convert the column to its intended class. It is important that this match exactly, or the updated table will contain all rows.

width

The grid width of the column (must be between 1 and 12)

display_name

The name to use for the column header

...

Elements to include within the column

Value

A col_def() object

Examples

# to create a col_def for mtcars$mpg
# it is a shiny::textInput that is disabled using shinyjs::disabled
col_def(
  name = 'mpg',
  input = input_call(
    fun = shiny::textInput,
    args = list(label = NULL, placeholder = 'mpg')
  ),
  cast = as.numeric,
  width = 3,
  display_name = 'MPG'
)
#> # A tibble: 1 × 5
#>   name  input_call cast   width display_name
#> * <chr> <list>     <list> <dbl> <chr>       
#> 1 mpg   <function> <fn>       3 MPG