In a modal dialog form I'm working on using Knockout.js, the "Submit" button triggers a method which should hide the dialog and then set the value of a variable.
self.updateSubTask = function(subTask) {
...
$('#subTaskDialog').modal('hide');
self.selectedSubTask(null);
};
When this function is called, the hide process begins - the dialog itself is removed - but is stopped before completion, and the grey background persists indefinitely. After some investigation, it is most likely that this is because the subsequent call to set the value of self.selectedSubTask
is disrupting the hide "animation". Unfortunately, the modal call must be made before the change to selectedSubTask
due to the way the dialog is set up. I've tried the following:
_.defer(function() { self.selectedSubTask(null); })
$('#subTaskDialog').queue(function() { self.selectedSubTask(null); });
Unfortunately, neither of these methods work, and the behaviour is the same.
I figure that a reasonable course of action would be to listen for when the dialog is hidden, and include the selectedSubTask
call in that event handler. I'm having difficulty finding a solution to achieve this, however. Any suggestions on how to do this, or any other methods to achieve my ultimate aim, would be greatly appreciated. Cheers!