The code below has action button in rendered in html. But when i click the button in second row(id as "ang") there is no modal box showing up. Can anyone help me? Not sure why this logic is not working.. If I put a normal button, it is working
library(shiny)
library(shinydashboard)
library(DT)
number_compare <- data.frame(replicate(2, sample(1:100, 10, rep=TRUE)))
# number_compare$direction <- ifelse(
# number_compare$X1 < number_compare$X2,
# as.character(icon("angle-up")),
# as.character(icon("angle-down"))
# )
sidebar <- dashboardSidebar()
body <- dashboardBody(
fluidRow(box(width = 12, solidHeader = TRUE,
DTOutput("example_table"))
)
)
ui <- dashboardPage(dashboardHeader(title = "Example"),
sidebar,
body
)
server <- function(input, output) {
number_compare$X2[which(rownames(number_compare) == 2)] = paste(with(number_compare, X2[rownames(number_compare) == 2])," ", as.character(actionButton("ang","")))
number_compare$X2[which(rownames(number_compare) == 4)] = paste(with(number_compare, X2[rownames(number_compare) == 4])," ", as.character(actionButton("angle2","", icon("angle-up"),style = "border: none;
outline:none;background:white")))
number_compare$X2[which(rownames(number_compare) == 6)] = paste(with(number_compare, X2[rownames(number_compare) == 6])," ", as.character(actionButton("angle3","", icon("angle-up"),style = "border: none;
outline:none;background:white")))
output$example_table <- DT::renderDT({
datatable(
number_compare,
escape = FALSE)
})
observeEvent(input$ang,{
showModal(modalDialog(
title = "Somewhat important message",
"This is a somewhat important message.",
easyClose = TRUE,
footer = NULL
))
})
}
shinyApp(ui, server)