Closed averissimo closed 6 months ago
app$set_active_filter_selection("iris", "Sepal.Length", c(4, 5), is_numeric = TRUE)
Are you sure you don't want to pass a teal_slice
?
That's a nice idea passing a teal_slice
. It's familiar and avoids that is_numeric
weirdness.
app$set_active_filter_selection(
teal_slice("iris", "Sepal.Length", selected = c(4, 5))
)
The operations that this call triggers would still be UI/input-based, but this would allow us to keep consistency.
Care to give insights on reasons to keep current formals @vedhav ?
ps. this would be a separate issue though as potential follow-up to this one.
The shinyWidgets::numericRangeInput
widget requires a custom handler to change the values.
I was able to do it via javascript (#1152), but if someone knows how to hint the handler via Shiny API, please chip in.
The caveat of doing it this way is that the input boxes still hold the previous values.
Side quest: The range input does not work out of the box with shinytest2
, but it has no issues with dynamic rendering as we do it :grin: https://github.com/rstudio/shinytest2/issues/376
Yeah, $setInputValue
and $setInput
are not entirely reliable. But doesn't shinyWidgets::updateNumericRangeInput
, which uses $sendInputMessage
, work?
For that we need access to the session
object, which I don't think we can easily access :-\
Oh, I see. I misunderstood the problem. Sorry.
I wasn't totally explicit in the description.
The issue here is that AppDriver
API does nothing when setting for the input_id.
chromote
(I'm not 100% sure though, feel free to correct me)Shiny.setInput
needs the handler suffix for some complex cases (such as the range input)So the downstream javascript call needs to be Shiny.setInput("an_input:sw.numericRange", [min, max])
Which is what the PR does skipping all middle layers of AppDriver
.
TealAppDriver$set_active_filter_selection
only works for categorical variables. It should also work for numeric ranges.Example below of test that should work