Pop up close action

  • 6
  • Idea
  • Updated 3 years ago
  • Under Consideration
I thought that this was already an idea, but I couldn't find it.

It would be great if Pop Ups can have action framework associated to the closing of it.

Even better would be the ability to block closing based on results of snippet. ie. Return True/False

This would allow the ability to check to see if any models have unsaved changes.

This "Unsaved Changes" is probably so common that it should be it's own property called "Close Popup behavior when their are unsaved changes:"
  • Close (default)
  • Block
  • Warn
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,704 Points 20k badge 2x thumb

Posted 3 years ago

  • 6
Photo of Joe Ort

Joe Ort

  • 2,256 Points 2k badge 2x thumb
When it's used to create new, it can cause duplication to occur as well.  For all of my pop ups that create new (new task pop ups are most common) I empty the model as an initial action to protect from this occurring.  

I think this is a great idea just adding - if "Close", allow actions to delete/empty data.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Yes, we have identified this as an improvement.  Like so many others....

Thanks for pushing guys - we love your creativity.  Hopefully we stay just far enough behind you that you don't get totally frustrated... 
Photo of Ryan Paddy

Ryan Paddy

  • 578 Points 500 badge 2x thumb
Is there any workaround for this while we wait for official functionality? E.g. listening for the popup close action in inline JS?

I have a popup with a Close button that perform actions before closing the popup, but a couple of times I've accidentally clicked the X on the popup window instead of the Close button and it bypasses the actions which causes problems. 
Photo of Ryan Paddy

Ryan Paddy

  • 578 Points 500 badge 2x thumb
I've just had a try, here's my take. Make the show popup button a multiple action, and after the show popup action add a snippet action with code like this:

skuid.$("div.ui-dialog").on('dialogclose', function(event) {     
    //do popup close actions here
});

The listener is triggered both by the X (at top right of popup windows) and any close actions in the popup. If you have multiple popup dialogs on your page you'll have to do something to distinguish which one has been closed.

I'm going to look at using this to cancel changes to the model edited in the popup when it's closed. 

I haven't had any luck using this listener to cancel the event (so the closing of the popup is prevented), if anyone has success with that I'd love to hear. 

As I understand there won't be any context for the record in the popup unless you've fudged something, such as a multiple action in the popup opener that sets the Id of the context row in the first row of a model created just for that purpose. 
(Edited)
Photo of Daisy More

Daisy More

  • 60 Points
Yes! I absolutely agree with you at this point, such kind of pop-up is a great feature, otherwise, we will have to fill in the information again. This kind of pop-up is much much more useful than those caused by adware.
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,704 Points 20k badge 2x thumb
Oh yeah!!! Barry made this component that you add to a popup that gives all these controls and more.

https://community.skuidify.com/skuid/topics/popup-controller-component-disable-x-escape-key-and-hook-dialog-events