I've read on topics that it's not possible to reset value of an actionButton with Shiny Package, but I couldn't find any trick to solve my problem.
I'd like to delete the text and the button in the main panel with this code :
library(shiny)
shinyUI(fluidPage(
titlePanel("Trying to reset text !"),
sidebarLayout(
sidebarPanel(
actionButton("button1","Print text")
),
mainPanel(
textOutput("textToPrint"),
br(),
uiOutput("uiButton2")
)
)
))
shinyServer(function(input, output) {
output$textToPrint <- renderText({
if(input$button1==0) (return(""))
else (return("Button clicked"))
})
output$uiButton2 <- renderUI({
if(input$button1==0) (return ())
else (return(actionButton("button2","Reset text and this button")))
})
})
What is the alternative to impossible input$button1 = 0 ?
Thanks in advance for your help,
Matt
Thanks to Joe Cheng, here is a nice way of doing it :