Pop up close action

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

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.

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… 

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. 

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. 

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.

Oh yeah!!! Barry made this component that you add to a popup that gives all these controls and more.

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