set_formatter_link | R Documentation |
Set link formatter
set_formatter_link(
widget,
column,
label_field = NULL,
url_prefix = NULL,
url = NULL,
target = "_blank",
hoz_align = "left"
)
widget |
A |
column |
The name of the column the formatter is applied to. |
label_field |
(character): Column to be used as label for the link. |
url_prefix |
(character): Prefix to add to the URL value. |
url |
(JavaScript function): A JavaScript function that return the URL value. The cell is passed to the function as its first argument. Use JS to pass JS code. |
target |
(character): Target attribute of the anchor tag. |
hoz_align |
(character): The horizontal alignment of the column. |
The updated tabulator()
HTML widget
data <- data.frame(
label = c("This is a link", "This is another link"),
link = c("https://eoda.de", "https://eoda.de/data-science"),
link2 = c("eoda.de", "github.com"),
link3 = c("guinan", "data-science")
)
js_func <- "(cell) => `https://eoda.de/${cell.getValue()}`"
tabulator(data) |>
set_formatter_link("link", label_field = "label") |>
set_formatter_link("link2", url_prefix = "https://") |>
set_formatter_link("link3", url = htmlwidgets::JS(js_func), label_field = "label")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.