闪亮 - 隐藏输入时重置输入的值?

时间:2017-06-02 15:37:44

标签: r shiny

隐藏时如何重置输入值?或者更好 - 当数据被隐藏时,不要将数据发送到服务器。有可能吗?

例如:

shinyUI(pageWithSidebar(
  headerPanel("Click the button"),
  sidebarPanel(

    radioButtons(
        inputId = "switch",
        label = "Select hide or show:",
        choices = c(
            "Show" = "show",
            "Hide" = "hide"
        ),
        selected = NULL,
        inline = FALSE
    ),

    conditionalPanel(
        condition = "input.switch == 'show'",
        numericInput("n", "N:", min = 0, max = 100, value = 0)
    ),

    actionButton("goButton", "Go!")
  ),
  mainPanel(
    textOutput("text")
  )
))


shinyServer(function(input, output) {

  # builds a reactive expression that only invalidates
  # when the value of input$goButton becomes out of date
  # (i.e., when the button is pressed)
  ntext <- eventReactive(input$goButton, {
    input$n
  })

  output$text <- renderText({
    ntext()
  })
})

当&#39;隐藏&#39>时,UI仍会将此numericInput的数据发送到服务器。选中并隐藏numericInput。我不希望UI在隐藏输入时发送数据。或者 - 将其重置为0.

有什么想法吗?

0 个答案:

没有答案