After filling and editing the data table, I want the full and edited data table saved, not as CSV or Excel file, but as a data frame. When I render the saved data table it's totally NULL.
dat2 <- NULL
data_22 <- eventReactive(input$create, {
dat2 <<- matrix(nrow = input$DMU_Num+2, ncol = input$ind_NUM+1)
colnames(dat2)[2:ncol(dat2)] <- paste0("Indicies ", 1:ncol(dat2))
colnames(dat2)[1]<-"Names"
dat2
})
output[["dtable2"]] <- renderDT({
datatable(
data_22(),
escape = T,
editable = list(target = "cell",colnames = TRUE),
class = 'cell-border',
extensions = "Buttons",
options = list(
dom = 'Blfrtip',
buttons=c('copy', 'csv', 'excel', 'pdf', 'print'),
br(),
lengthMenu = list(c(10, 25, 50, -1), c(10, 25, 50, "All"))
)
)
})
observeEvent(input[["dtable_cell_edit2"]], {
dat2 <<- editData(dat2, input[["dtable_cell_edit2"]], proxy, rownames = TRUE)
})
saved <- eventReactive(input$save,{
dat2
})
renderTable({
saved()
})