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

Detect if a slimSelectInput is open/closed #715

Open
jistria opened this issue Nov 1, 2024 · 2 comments
Open

Detect if a slimSelectInput is open/closed #715

jistria opened this issue Nov 1, 2024 · 2 comments

Comments

@jistria
Copy link

jistria commented Nov 1, 2024

Hi, thanks for adding the slimSelectInput widget. Is there a way to detect if a slimSelectInput is open/closed? Similar to input$<inputId>_open for pickerInput.

@jistria
Copy link
Author

jistria commented Nov 4, 2024

I was able to achieve this using the following JavaScript:

$(document).on('shiny:connected', function(event) {
  document.querySelector('#<inputId>').slim.events.beforeClose = () => {
    Shiny.setInputValue('<inputId>_open', false);
  };
  document.querySelector('#<inputId>').slim.events.afterOpen = () => {
    Shiny.setInputValue('<inputId>_open', true);
  };
});

I'll leave this issue open for you to consider alternative solutions and close when you wish. Thanks.

@pvictor
Copy link
Member

pvictor commented Nov 4, 2024

Thanks for the solution, I'll will implement this in the bindings.

Victor

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