save edited datatable as dataframe in shiny

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()
})

dtable_cell_edit2
why does this have a 2 on the end ?
if shiny is making an input for you its appending _cell_edit onto the end of the tablename in question and letting you access it through that; I dont think it would ever put a 2 on the end ...

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.