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

airDatepickerInput() Clear button does not clear the blue highlighting #703

Open
shahreyar-abeer opened this issue Sep 3, 2024 · 1 comment

Comments

@shahreyar-abeer
Copy link

Hi @pvictor

Great package!
I have encountered an issue with the airDatepickerInput(), when the 'Clear' button is clicked, the blue highlighting is not removed.
(See attached .gif)

I have solved the issue with some JS.
Here is the solution

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
  tags$head(
    tags$script(
      '$(document).on("shiny:bound", function(e) {
        console.log(e.target.id)
        if (e.target.id === "multiple") {
          $(".air-datepicker-button span:contains(\'Clear\')").parent().on(\'click\', function() {
            $(".-in-range-").each(function(i, cell) {$(cell).removeClass(\'-in-range-\')})
          })
        }
      })'
    )
  ),
  airDatepickerInput(
    inputId = "multiple",
    label = "Select multiple dates:",
    placeholder = "You can pick a range of dates",
    range = TRUE, clearButton = TRUE, inline = TRUE
  ),
  verbatimTextOutput("res")
)

server <- function(input, output, session) {
  output$res <- renderPrint(input$multiple)
}

shinyApp(ui, server)

}

airDatePicker-issue

@pvictor
Copy link
Member

pvictor commented Sep 3, 2024

Hello,
Thanks for reporting the issue and for providing a solution, I'll wait to see if the javascript library is updated.

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