【发布时间】:2021-05-19 11:25:47
【问题描述】:
我想在 writeLines 操作后使用函数 updateTextInput 清除 textAreaInput() 内的文本写入,但未成功。在我的例子中:
# Packages
require(shiny)
require(shinythemes)
# Create the shiny dash
ui <- fluidPage(
theme = shinytheme("cosmo"),
titlePanel(title="My Map Dashboard"),
sidebarLayout(
sidebarPanel(
textAreaInput("text_input","Write something"),
actionButton("erefunction", "Erase")
),
mainPanel(
textOutput("idSaida")
)
)
)
server <- function(input, output){
observeEvent(input$erefunction, {
filePath <- tempfile(fileext = ".txt")
writeLines(c(input$text_input), filePath)
updateTextInput(value="")
})
}
shinyApp(ui, server)
##
请提供任何提示或解决方案。提前致谢!
【问题讨论】: