library(shiny)
library(rhandsontable)
ui = shinyUI(fluidPage(
fluidRow(wellPanel(
rHandsontableOutput("hot"),
actionButton(inputId="enter",label="enter")
))
))
server=function(input,output){
DF=data.frame(Code=c(1,2,3),Amount=c(NA,NA,NA))
output$hot=renderRHandsontable(rhandsontable(DF,readOnly=F))
observeEvent(input$enter, {
DF=hot_to_r(input$hot)
print(DF)
})
}
shinyApp(ui = ui, server = server)
嗨,我想从闪亮的 rhansontable 输入。但是,当列的单元格充满 NA 时,无法编辑单元格。这些可以解决吗?谢谢
还有当我像这样更改数据类型时
output$hot=renderRHandsontable(rhandsontable(DF,readOnly=F) %>% hot_col(col = "Amount", type = "numeric"))
可以编辑单元格中的值。但是,当我使用 'DF=hot_to_r(input$hot)' 时,这些值似乎没有保存在 DF 中。