shiny - Get edited cells from R ShinyTable to update dataFrame -


i have r dataframe rendering in r shinytable. editing in shinytable works fine.

my question is: how take edits user has made , update dataframe.

the code below taken tutorial site shinytable. has error: "attempted access deprecated shinysession$session object. please access shinysession object directly." there nothing in code refers shinysession.

if can answering primary question (how take edits user has made) can around error.

 library(shiny)  library(shinytable) server <- function(input, output, session) {   rv <- reactivevalues(cachedtbl = null)   output$tbl <- renderhtable({     if (is.null(input$tbl)){       tbl <- matrix(0, nrow=3, ncol=3)       rv$cachedtbl <<- tbl       return(tbl)     } else{       rv$cachedtbl <<- input$tbl       return(input$tbl)     }   })      output$tblnonedit <- rendertable({     input$actionbuttonid     isolate({       rv$cachedtbl     })   })     } ui <- shinyui(pagewithsidebar(   headerpanel("shinytable actionbutton apply changes"),   sidebarpanel(     helptext(html("                   make changes upper table, press button activate.                    <p>created using <a href = \"http://github.com/trestletech/shinytable\">shinytable</a>."))),   mainpanel(     htable("tbl"),     actionbutton("actionbuttonid","apply edits"),     tableoutput("tblnonedit")   ) ))  shinyapp(ui = ui, server = server) 

it looks shinytable hasn't been updated few years. session error occurring in package code, not code.

try rhandsontable instead.

i found question/answer sample code works: update handsontable editing table and/or eventreactive

library(shiny) library(rhandsontable)  did_recalc <- false  ui <- fluidpage(   rhandsontableoutput('table'),   textoutput('result'),   actionbutton("recalc", "generate new random vals , calculate") )  server <- function(input,output,session)({   values <- reactivevalues(data=as.data.frame(runif(2)))    observe({     input$recalc     values$data <- as.data.frame(runif(2))   })    observe({     if(!is.null(input$table))       values$data <- hot_to_r(input$table)   })     output$table <- renderrhandsontable({     rhandsontable(values$data)   })     output$result <- rendertext({      sum(values$data)   }) })    shinyapp(ui = ui, server = server) 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -