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

updateAirDateInput does not fully overwrite value #705

Open
ZIBOWANGKANGYU opened this issue Sep 11, 2024 · 1 comment
Open

updateAirDateInput does not fully overwrite value #705

ZIBOWANGKANGYU opened this issue Sep 11, 2024 · 1 comment

Comments

@ZIBOWANGKANGYU
Copy link

Similar to the issue here, updateAirDateInput does not fully overwrite value in an airDatepickerInput. Instead, if a date has been selected by an old call to updateAirDateInput, it will remain selected even if it is not included in the value in a new call to updateAirDateInput. The problem exists in both versions 0.8.6 and 0.8.6.9100.

Repex

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
  airDatepickerInput("date_input", "Pick a date", multiple = TRUE),
    
  actionButton("select_new_date", "Select new date")
)

# Define server logic required to draw a histogram
server <- function(input, output, session) {
  click_count <- reactiveValues(select_new_date = 0)
  observeEvent(input$select_new_date, {
    updateAirDateInput(inputId = "date_input", value = Sys.Date() + click_count$select_new_date) # After each time clicking "select_new_date", only one date should be selected, and the previously selected dates should be de-selected. But this is not the case. Previously selected dates remain selected. 
    click_count$select_new_date <- click_count$select_new_date + 1
  })
}
@pvictor
Copy link
Member

pvictor commented Sep 13, 2024

Good catch, it's fixed if you re-install from GitHub.

Victor

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

No branches or pull requests

2 participants