Skip to content

Commit

Permalink
adjust the state of the slider_input based on the values from numeric…
Browse files Browse the repository at this point in the history
…_input
  • Loading branch information
m7pr committed Oct 7, 2024
1 parent 2001fd7 commit 9aef533
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions R/toggleable_slider.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#'
#' # use non-exported function from teal.goshawk
#' toggle_slider_ui <- getFromNamespace("toggle_slider_ui", "teal.goshawk")
#' toggle_slider_server <- getFromNamespace("toggle_slider_server", "teal.goshawk")
#'
#' ui <- div(
#' toggle_slider_ui(
Expand Down Expand Up @@ -213,7 +214,12 @@ toggle_slider_server <- function(id, is_dichotomous_slider = TRUE) {
state_high$value <- state_high$value[[2]]
}
if (input$toggle %% 2 == 0) {
if (input$toggle > 0) {
state_slider$max <- max(state_slider$max, state_slider$value[2])
state_slider$min <- min(state_slider$min, state_slider$value[1])
}
do.call(updateSliderInput, c(list(session, "slider"), state_slider))

} else {
if (length(state_slider$value) > 1) {
do.call(updateNumericInput, c(list(session, "value_low"), state_low))
Expand Down
1 change: 1 addition & 0 deletions man/toggle_slider_ui.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9aef533

Please sign in to comment.