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

crosstalk.FilterHandle doesn't return the same type consistently #140

Open
daattali opened this issue Apr 9, 2023 · 0 comments
Open

crosstalk.FilterHandle doesn't return the same type consistently #140

daattali opened this issue Apr 9, 2023 · 0 comments

Comments

@daattali
Copy link
Contributor

daattali commented Apr 9, 2023

When a filter_select() is used, the FilterHandle callback returns the keys as a string array. When a filter_slider() is used, a numeric array is returned.

Example:

library(shiny)

df <- data.frame(id = 1:5, num1 = 11:15, num2 = 21:25)
shared_df <- crosstalk::SharedData$new(df, key = ~id, group = 'test')

ui <- fluidPage(
  crosstalk::filter_select("num1", "num1", shared_df, ~num1),
  crosstalk::filter_slider("num2", "num2", shared_df, ~num2, step = 1),
  
  tags$script(HTML(
    'ctFil = new crosstalk.FilterHandle("test");
     ctFil.on("change", function(e) { console.log(e.value); });'
  ))
)

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

shinyApp(ui, server)

Make selections using either filter, and look at the javascript console.

https://www.loom.com/share/bb379b56dd2349e48b894895d15ba7c1

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

1 participant