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
Dismiss modal after CallbackR finished #29
Comments
Thanks for the inititative to create the PR and the great example. I did previously have a With your proposed solution, are you now required to call This isn't to say that having a dismiss function isn't useful - if it works correctly then I would be happy to have that function. And with a dismiss function along with #26 , a user would be able to do what you want to do easily by adding an action button and running the callback+dismiss on that button instead of using the What do you think? |
Thanks for the reply, please let me explain :)
I didn't want
My initial issue description might be confusing, I don't want to change anything that already exists, and I agree with you on callback should be called once button is clicked. However, if you look closely to the code, you'll find I have two alerts in a row. The first one shows the normal alert, once users click on the OK button, the first one is dismissed, callback gets called, in the meanwhile, the second alert pops up. The second alert is what I want. It's a message alert that cannot be closed by hitting outside of the message box nor Once "OK" button is clicked the second alert pops up. When |
You're right that I didn't try your code - I tried running your first sample code, but the second one I thought wouldn't work because it uses the new function you added. Anyway, I would approach this a little differently: you want the second modal to be called after the first one as a callback. So I would do it as:
Or instead of the last shinyalert, a dismiss/close function would be appropriate there. So your PR for a dismiss can still be useful. But do you agree that this approach would be more fitting for your situation? |
Oh, the first sample code doesn't have 2 alerts. I used it to purely display the issue/scenario: if you launch modal, dismiss the modal and press "Ok" button at once to launch alert again, because Yes, your example fit in my case. The third alert |
I fully support having a dismiss function (I would prefer to call it shinyalert shouldn't try to solve the generic problem of letting the user know when shiny is busy - that's a shiny issue that's out of scope for shinyalert. This also made me think of another useful feature - adding a I also discovered a couple bugs with |
Cool! I like the name Adding option to set |
Please submit one PR for fixing the javascript, and one PR for adding the |
Fixed with #37 |
Background
callbackR
function is executed after modal being dismissed. One potential problem is ifcallbackR
takes seconds to run, the Shiny apps will freeze up.Simple example
If you dismiss the modal and immediately press the "Ok" button, the app freezes around 3 seconds before opening the modal again. This greatly affects user's experience and making
callbackR
less attractive.My Solution
I modified your code a little bit, added a function called
dismissalert
to manually remove messages. I'll submit a PR soon, here is my forked repo. Basically I modified your JS code, and added R functiondismissalert
to remove arbitrary number of modals.The working example looks like this:
The text was updated successfully, but these errors were encountered: