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 filter_select: cannot unselect already selected value #125

Open
novotny1akub opened this issue Apr 12, 2022 · 1 comment
Open

Comments

@novotny1akub
Copy link

I am trying to use crosstalk to filter a plotly chart. I use crosstalk's filter_select to (un)filter a plotly chart. When using the reprex below trying to select a flower (e.g. setosa), all works fine. But when I unselect the flower, the values are not 'returned' to the plotly chart. Selecting '(All)' does not seem to be working either. The values reappear only when deselecting from flower filter AND ticking TRUE in the helper_select_all. I asked a question about this on StackOverflow, but there do not seem to be any answer until now.

library(crosstalk)
library(plotly)

df <- iris
df$helper_select_all <- T

shared_data <- SharedData$new(df)

filter <- bscols(
  list(
    filter_select("flower", "Select a flower", shared_data, ~Species),
    filter_checkbox(
      "helper_select_all",
      label = "Reset filtering as deselecting from 'Select a flower' is not working",
      shared_data, ~helper_select_all)
  )
)


p <- plot_ly(shared_data, x = ~Sepal.Length, y = ~Sepal.Width) %>% 
  add_markers()


bscols(filter, p)

This picture demonstrates the issue as no filtering value is selected, but a part of the data is missing.
enter image description here

This picture shows what it looks like when all datapoints are present.
enter image description here

"(All)" does not seem to be working either.
enter image description here

@helgasoft
Copy link

+1
Deselecting does not refresh the plot.
And selecting (All) gives JS error:
input_selectize.js:40 Uncaught TypeError: Cannot read property 'forEach' of undefined

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