I am using renderUI to create dynamic textboxes and dropdown on my UI. I want to capture the event of change in the textbox / dropdown and modify the data frame
Below is the code to create the UI
server <- function(input, output, session){
output$fileContent <- renderTable({
inFile <- input$csvFile
csvContent <- read.csv(inFile$datapath)
output$summary <- renderPrint({str(csvContent)})
allColumns <- names(csvContent)
types <- sapply(csvContent, class)
w <- ""
for (i in 1:length(allColumns)){
w <- paste(w, selectInput(paste("inp",allColumns[i], sep = "_"), allColumns[i],choices = c("factor","integer","logical","character", "Date"), selected = types[i], width = 200))
}
output$columns <- renderUI({ HTML(w) })
return (head(csvContent))
})
Desired output -
The code above renders the textboxes as desired on the UI but does not capture event on change of value in textbox. Since the controls are dynamic, I can not code for static capture event as the control name would be generated dynamically
Got the answer on https://gist.github.com/mine-cetinkaya-rundel/0fe2a9830f7151e72053239e73350592
It has sample application that works fine with dynamic UI