I would like to include a button in my shiny app that restarts the shiny session (the purpose being to reset the value of all inputs & action buttons). I am aware that shiny has the session$reset()
function, and that the package shinyjs
includes the reset()
and refresh()
functions for this purpose.
These options are working to refresh the page, but when I use them (or when I hit refresh manually), the formatting of my app becomes lost. Here are sample code and images illustrating the problem.
library(rhandsontable)
data = matrix(rnorm(10*10,mean=0,sd=1), 10, 10)
ui <- fluidPage(
titlePanel('Patient Search v2.0'),
sidebarLayout(
sidebarPanel(
textInput('search', 'Search')
),
mainPanel(
rHandsontableOutput('data')
)
)
)
server <- function(input, output, session){
df = data
output$data <- renderRHandsontable({rhandsontable(df)})
session$onSessionEnded(stopApp)
}
runApp(list(ui = ui, server = server), launch.browser = TRUE)