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

Implement default selections #70

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

jcheng5
Copy link
Member

@jcheng5 jcheng5 commented Jul 7, 2019

Fixes #35.

@jcheng5 jcheng5 force-pushed the joe/feature/filter-select-default branch from 33dffd8 to ee8c64e Compare July 7, 2019 00:58
@jcheng5 jcheng5 changed the title Implement default selection for filter_selectFixes #35 Implement default selection for filter_select Jul 7, 2019
@mabecker89
Copy link

Thanks for this. Will this functionality be available soon?

@paulklemm

This comment has been minimized.

@jcheng5
Copy link
Member Author

jcheng5 commented Oct 18, 2019

I can't repro with Leaflet:

library(crosstalk)
library(leaflet)

sd <- SharedData$new(quakes)
filt <- filter_select(
  id = "mag",
  label = "Select magnitude",
  sharedData = sd,
  group = ~as.integer(mag),
  multiple = FALSE,
  selected = 5
)

map <- leaflet(sd) %>% addMarkers()

bscols(widths = c(3,9), filt, map)

@cpsievert, maybe something for us to take a quick look at together next week.

@Nova-Scotia
Copy link

This issue is still happening for me, like @paulklemm, using ggplotly and downloading from devtools::install_github("rstudio/crosstalk", ref = "joe/feature/filter-select-default").

@gtdca98
Copy link

gtdca98 commented Mar 27, 2020

Fixes #35.

(I would LOVE some help implementing the same for filter_checkbox and filter_slider.)

For filter_checkbox you can add at the end of flexdashboard <script > $('input[name="SelYear"][value=2020]').attr("checked", true); </script> assumming that "SelYear" is the id
filter_checkbox(id="SelYear", label = "", sharedData = sd19, group = ~YEAR, inline = FALSE)

@CLAassistant
Copy link

CLAassistant commented Apr 23, 2020

CLA assistant check
All committers have signed the CLA.

@paulklemm
Copy link

It seems that the problem I reported only happens with plotly. See @cpsievert post here: #16 (comment)

@ashishjain1988
Copy link

Is this feature has been updated? There is no "selected" argument in the latest CRAN update.

@cpsievert cpsievert mentioned this pull request Jun 10, 2021
@cpsievert cpsievert changed the title Implement default selection for filter_select Implement default selections Jun 10, 2021
R/controls.R Outdated Show resolved Hide resolved
@jcheng5 jcheng5 force-pushed the joe/feature/filter-select-default branch from b420e9f to 57ab29b Compare June 10, 2021 19:12
@cpsievert cpsievert added this to the Next release milestone Jun 10, 2021
Copy link
Contributor

@cpsievert cpsievert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about this more, it seems better for selected to be specified through SharedData (either through $new() or via $selection()?), not the input controls. The benefit being that we'd also have a way to specify default selections (not just filter)

@mattkerlogue
Copy link

Hi, can I ask what the status of this PR is? I've been relying in a couple of toy projects on installing the branch version that implements this change, I'd like to use it in some production code (in a non-Shiny rmarkdown project) but would prefer to use the "main" version of the package rather than a branched offshoot.

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

Successfully merging this pull request may close these issues.

filter_select default value
9 participants