R shinyFiles shinySaveButton“创建新文件夹”+按钮导致错误

时间:2017-07-19 10:27:10

标签: r shiny

我正在使用this question答案中的代码,我在此处将其作为一个工作示例。

 function suma()
{ 
alert("hi");
$('#one').on("click", function(){
if($("#two").find("#one")==0){
    $('#one input:checked').parent().parent().appendTo("#two");
}
if($("#two").find("#one").find("<tr><td> a </td>","<td> b</td>","<td> c</td></tr>") ==0){
    $("#two").find("#one").append("<tr><td> a </td>","<td> b</td>","<td> c</td></tr>");
}
});
}

当我尝试使用“创建新文件夹”子菜单中的+按钮创建文件夹时出现以下错误:

library(shiny)
library(shinyFiles)
library(xlsx)

ui <- shinyUI(fluidPage(

  titlePanel("Example"),
  shinySaveButton("save", "Save file", "Save file as ...", filetype=list(xlsx="xlsx"))

))

server <- shinyServer(function(input, output, session) {

  observe({
    volumes <- c("UserFolder"="C:/")
    shinyFileSave(input, "save", roots=volumes, session=session)
    fileinfo <- parseSavePath(volumes, input$save)
    data <- data.frame(a=c(1,2))
    if (nrow(fileinfo) > 0) {
      write.xlsx(data, as.character(fileinfo$datapath))
    }
  })
})

shinyApp(ui = ui, server = server)

但是,当我按Enter键而不是使用+按钮时,我得到了正确的行为。做了一些搜索但找不到相关的东西。任何帮助表示赞赏。

0 个答案:

没有答案