I would like to obtain the row number and choice selected each time an input is changed in one of the selectInput. The following is a test code. So in short if I change the species in row three, using observeEvent
I would like the output to tell me what row was it in and what was picked.
Is there a way of doing this.
library(shiny)
library(DT)
ui <- fluidPage(
DT::dataTableOutput('foo'),
textOutput("text")
)
server <- function(input, output, session) {
data <- head(iris, 5)
for (i in 1:nrow(data)) {
data$species_selector[i] <- as.character(selectInput(paste0("change", i), label = paste0("change", i), choices = unique(iris$Species), width = "100px"))
}
output$foo = DT::renderDataTable(
data, escape = FALSE, selection = 'none', server = FALSE,
options = list(dom = 't', paging = FALSE, ordering = FALSE))
observeEvent$...
}
shinyApp(ui, server)