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

how to observe inputs from a dynamically produced dropdownBlock #136

Open
D3SL opened this issue May 9, 2021 · 0 comments
Open

how to observe inputs from a dynamically produced dropdownBlock #136

D3SL opened this issue May 9, 2021 · 0 comments

Comments

@D3SL
Copy link

D3SL commented May 9, 2021

Hello. First off as is github tradition thank you for the fantastic package, it's got a lot of great expansions to the original shinydashboard that add a lot to usability and QoL.

I'm having some trouble with one of the updates to dropdowns though. Right now I use renderMenu() to capture inputs and dynamically populate a dropdownMenu() I use as a log during my shift, with items like "#XXXX - Foo'd the bar". I want to switch to dropdownBlock() so those items become clickable inputs but I can't figure out the server side logic since the inputs are all dynamically created on the fly.

So far the closest I've gotten is giving all dropdown items a shared unique prefix like "dropdownfoo_", using javascript in UI.r to pass the name of any input triggered to Server.r as input$last_button, and then using observeEvent() with conditional logic to check if the input's name starts with "dropdownfoo_".

This works, but it's laggy and triggers when it isn't supposed to. The input$last_button reactive chain seems to pick a specific item in the dropdownBlock() and get "stuck" on it. Anytime I trigger renderMenu() to re-render the dropdown by altering an existing item or adding a new one the app will react as if I clicked on the specific item it's stuck on.

Example: Say I have the following entries:

"#001 - foo"
"#002 - bar"
"#003- baz"

If I change entry 001 to say "foobar" that will be updated, but then the app will react as if I had clicked 003 immediately after. If I add a new entry ("004 - barbaz") then it will save the new entry and again immediately afterwards react as if I had clicked 003. This also seems to be triggered sometimes while I'm going other places in the app and other things are being rendered.

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