Following on from this post, I wonder why showModal()
inside of observeEvent()
does not get triggered when i click on the cell rendered button?
I give the button the fixed ID 'character' on which the observeEvent()
should listen and then open the modal box. But it doesnt.
Where is the difference if i place a button in the ShinyApp UI, where the observeEvent()
would react to the inputid, or if I place it in a reactable?
library(shiny)
library(reactable)
library(tidyverse)
data = dplyr::starwars %>%
select(name, height, mass, sex, species, homeworld)
ui = fluidPage(
column(width = 6, style = "margin-top: 50px;",
reactableOutput("table"))
)
server = function(input, output, session){
output$table = renderReactable({
reactable(data = data,
height = 600,
defaultPageSize = 20,
columns = list(
name = colDef(
cell = function(value){
div(htmltools::tags$button(value, class = "action-button", id = "character"))
})))})
observeEvent(input$character, {
showModal(modalDialog(title = "Test"))
})
}
shinyApp(ui, server)