Skip to content

event_data not working for Shiny Modules? #659

Description

@happyshows

Hi,

I tried a couple combinations but couldn't get it to work, please advise:

`
library(shiny)
library(shinyBS)
library(plotly)

Module.testUI <- function(id){
ns <- NS(id)
plotlyOutput(ns('ply_main'))
}

Module.test <- function(input, output, session, sess) {
ns <- session$ns

output$ply_main <- renderPlotly({
df1 <- data.frame(x = 1:10, y = 1:10)
plot_ly(df1, x = ~x, y = ~y) %>% add_markers()
})

observe({
# eventdata <- event_data(ns('plotly_click'))
eventdata <- event_data('plotly_click',source = ns('ply_main'))
# eventdata <- event_data('plotly_click')
isolate({
print(eventdata)
})
})
}

ui <- fluidPage(
tagList(
Module.testUI('test'),
Module.testUI('test2')
)
)

server <- function(input, output) {

callModule(Module.test,'test', sess)

callModule(Module.test,'test2', sess)
}

shinyApp(ui = ui, server = server)
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions