You can install the development version of from GitHub with:
# install.packages("remotes")
remotes::install_github("rappster/dtf")
An interface to customize DT::datatable()
in a structured and
composable way
Because I never seem to be able to remember the exact combination of
extensions
and options
and how they interact.
library(dtf)
See https://rstudio.github.io/DT/extensions.html (setion 1. AutoFill)
With the AutoFill extension, you will see a blue square in the bottom-right corner of a cell when you mouse over the cell. You can drag it to automatically fill the column.
mtcars %>% datatable2(bundle = dt_bundle_autofill())
mtcars %>% datatable2(bundle = "AutoFill")
For comparison when calling DT::datatable()
mtcars %>% DT::datatable(
extensions = "AutoFill",
options = list(
autoFill = TRUE
)
)
mtcars %>% datatable2(
bundles = dt_bundle_autofill(columns = c(1, 2, 3))
)
mtcars %>% datatable2(
bundles = dt_bundle_autofill(columns = c(1, 2, 3), focus = "click")
)
mtcars %>% datatable2(
bundles = dt_bundle_autofill(
columns = c("mpg", "disp"),
focus = "click",
.data = mtcars
)
)
mtcars %>% datatable2(
bundles = list(
dt_bundle_autofill(
.options = list(columns = c(1, 2, 3), focus = "click")
)
)
)
For comparison when calling DT::datatable()
mtcars %>% DT::datatable(
extensions = "AutoFill",
options = list(
autoFill = list(columns = c(1, 2, 3), focus = "click")
)
)
mod_render_dt_server(
id = "my_id",
output_id = "dt",
data = mtcars
)