Update handsontable by editing table and/or eventReactive

半世苍凉 提交于 2019-11-27 04:33:30

You could store the data in a reactiveValues and have two observers updating it; one if the button is clicked, one if the table is edited by hand.

In your output$table and output$result, you then just need to use the data that is in the reactiveValues. Here's an example (same ui.R as you posted):

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)
  })
}) 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!