Thanks for the solution! I'd suggest you move renderDataTable() and
observeEvent() out of renderUI(), although in this particular case it
probably does not matter:
library(shiny)
shinyApp(
ui = fluidPage(
mainPanel(
uiOutput("tabs")
)
),
server = function(input, output) {
output$tabs <- renderUI({
tables <- lapply( list("dt1", "dt2", "dt3"), function(x){
DT::dataTableOutput( x )
})
tagList(tables)
})
lapply( list("dt1", "dt2", "dt3"), function(x) {
output[[x]] <- DT::renderDataTable( DT::datatable( data.frame("data") ) )
observeEvent({
input[[paste( x, "rows_selected", sep="_" )]]
},{
print( paste( x, ":", input[[paste( x, "rows_selected", sep="_" )]] ) )
})
})
}
)
Regards,
Yihui
> --
> You received this message because you are subscribed to the Google Groups
> "Shiny - Web Framework for R" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
shiny-discus...@googlegroups.com.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/shiny-discuss/a018dcd4-f39a-49dc-92fa-3331eb265cb5%40googlegroups.com.
>
> For more options, visit
https://groups.google.com/d/optout.