I have a shiny app where one of the functionality is allowing the user to edit the values in the table and when clicked on run it will use the user inputs as the value to a function and then update the results in the same table. Below is the example of the current table and the expected table. So in the first table if the user changes the values for current for Channel A and C and click run it should update itself to the values reflected in table expected output.
So my question is, is it possible to take editable DT values as an input to a function.
library(shiny)
library(DT)
shinyApp(
ui = fluidPage(
DT::dataTableOutput("x1"),
actionButton("opt_run", "Run"),
tags$h1("Expected Output"),
DT::dataTableOutput("x2")
),
server = function(input, output, session) {
df <- data.table(Channel = c("A", "B","C"),
Current = c("2000", "3000","4000"),
Modified = c("2500", "3500","3000"),
New_Membership = c("450", "650","700"))
output$x1 = renderDT(df, selection = 'none', editable = TRUE)
expdf <- data.table(Channel = c("A", "B","C"),
Current = c("3000", "3000","5000"),
Modified = c("3500", "3500","6000"),
New_Membership = c("650", "650","1100"))
output$x2 = renderDT(expdf, selection = 'none', editable = TRUE)
})
}
)