How to Run a Function after Modal is Closed in Widget

Mark Endsley
Tera Guru

I'm trying to run code after a Modal is closed on a widget. I am opening the modal in my widget and using .then. What I have noticed though is that the .then never runs if the user closes the Modal instead of pushing 'Ok'.

 

		spModal.open({
			widget:'widget-form',
			widgetInput:{table:parms.table, sys_id:parms.sys_id},
			size:'lg'
		}).then(function(name){
			myEl.removeClass('disabledbutton');
		});
		

 

In my example the class is never removed in the case that the user pushes the X in the top right corner of the modal.

in a uib modal there is a .closed.then apparently, but this doesn't work with spModal

If this is not possible it would be good if I could just find a way to run this code once the Modal has loaded up, that is fine too.