Skip to contents

A prop that takes a function – a table's formatter, a tree's filter_node_method, a date picker's shortcuts – takes JavaScript source marked with JS(), which the page evaluates rather than passing on as text. It is the same mark htmlwidgets::JS() makes, so either works, and so does DT::JS().

Usage

JS(...)

Arguments

...

JavaScript source, as one or more strings, joined by newlines.

Value

The source, classed "JS_EVAL".

Examples

JS("function(row, column, value) { return value.toFixed(2); }")
#> [1] "function(row, column, value) { return value.toFixed(2); }"
#> attr(,"class")
#> [1] "JS_EVAL"