Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reproduce a time value in shiny using Bookmark #15

Open
TPvdM opened this issue Feb 7, 2022 · 2 comments
Open

Reproduce a time value in shiny using Bookmark #15

TPvdM opened this issue Feb 7, 2022 · 2 comments

Comments

@TPvdM
Copy link

TPvdM commented Feb 7, 2022

I am trying to create a shiny app in which one is able to set a specific date, time and value and save those in a URL. That way, when you want to enter a second set of values, you won't have to again enter those first values.

I succeeded saving dates and numeric values; However, for some reason when using timeInput (from shinyTime) for setting a specific time, it resets after bookmarking and pasting the URL. Any suggestions how to prevent the time from resetting or how to circumvent this?

@TPvdM
Copy link
Author

TPvdM commented Feb 7, 2022

library(shiny)
library(tidyverse)
library(shinyTime)

ui <- function(request) {
          fluidPage(
          titlePanel("Test"),
          bookmarkButton(label = "Save"),
          dateInput("d1",
                    "Date",
                    format = "dd-mm-yyyy",
                    value =  ""),
          
          timeInput("t1", "Time", seconds = FALSE),
          numericInput("b1",
                       "Value",
                       value = ""),
          mainPanel(
                    textOutput("selected_var")
          ))}

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


          output$selected_var <- renderText({ 
                    paste("The date is",
                          paste(input$d1, strftime(input$t1, format="%H:%M")),
                          "with the following value:",
                          paste(input$b1)
                          
                          )})
}

shinyApp(ui = ui, server = server, enableBookmarking = "url")

@burgerga
Copy link
Owner

Sorry for the late reply, my notification settings were all wrong and I didn't get notifications for new issues. This is a nice enhancement, but unfortunately, I don't have time for it at the moment. Pull requests are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants