Home > Software design >  Pop up message when clicked on icon on column headers
Pop up message when clicked on icon on column headers

Time:02-22

While rendering DT table in shiny, is there a way to add pop up icon as shown below. So when user clicks on it, it should show some message :)

datatable(iris)  #### while rendering DT table

enter image description here

CodePudding user response:

Since you mention in your comment that you’d like the contents of the message to also be clickable, you might be interested in popover on icon in datatable header

CodePudding user response:

You can set the column names like this:

library(shiny)
library(DT)

ui <- fluidPage(
  DTOutput("table")
)

server <- function(input, output, session) {
  output$table <- renderDataTable(escape = FALSE, {
    colnames(iris) <- c("Sepal Length", "Sepal Width", "Petal Length",
       "Petal Width <div title ='Hover tooltip'>info</div>", "Species")
    iris
  })
}

shinyApp(ui, server)

enter image description here

However, things like shiny::icon("info-circle") don't in the colnames.

  • Related