I would like to change checkbox icon for row selection from "tick mark" to "xmark" on reactable in shiny. Not sure how to do this. Here is my attempt:
library(shiny)
library(reactable)
library(shinyWidgets)
ui <- fluidPage(
titlePanel("row selection example"),
reactableOutput("table"),
verbatimTextOutput("selected")
)
server <- function(input, output, session) {
selected <- reactive(getReactableState("table", "selected"))
output$table <- renderReactable({
reactable(iris, selection = "multiple", onClick = "select",
columns = list(
.selection = colDef(
sticky = "left",
cell = function (value,index) prettyCheckbox(inputId=paste0("cb",index),
label="",
value = FALSE,
icon = icon('times')))
)
)
})
observe({
print(iris[selected(), ])
})
}
shinyApp(ui, server)