I would like to ask if it is possible to have the tickboxes of all the rows selected by default -instead of deselected- in a DT datatable.
library(DT)
library(tidyverse)
dataTableOutput("irisTable")
output$irisTable <- renderDataTable(
iris %>% rowid_to_column("Row") %>% mutate(Row = ""),
rownames = FALSE,
extensions = "Select",
options = list(
columnDefs = list(list(className = "select-checkbox", targets = 0, orderable = FALSE)),
select = list(style = "multi", selector = "td:first-child")
))
Yes, you can write the custom
JS
Function like so: Here we pre-select the rows 1,3 and 4 (note that the count starts from 0)