[FEATURE] Trigger event after modals dismiss 33/46933/3
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Sat, 27 Feb 2016 21:17:47 +0000 (22:17 +0100)
committerBenni Mack <benni@typo3.org>
Sun, 6 Mar 2016 00:01:49 +0000 (01:01 +0100)
A new event ``modal-destroyed`` is triggered after modals dismissed.

Change-Id: Id05bf17889889bf1bacbd6a6ad3023923899671d
Resolves: #73720
Releases: master
Reviewed-on: https://review.typo3.org/46933
Reviewed-by: Jan Helke <typo3@helke.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/backend/Resources/Public/JavaScript/Modal.js
typo3/sysext/core/Documentation/Changelog/master/Feature-73720-TriggerEventAfterModalWindowDismissed.rst [new file with mode: 0644]

index eed1538..cb2150e 100644 (file)
@@ -228,6 +228,7 @@ define(['jquery',
                                Modal.instances.splice(lastIndex, 1);
                                Modal.currentModal = Modal.instances[lastIndex-1];
                        }
+                       currentModal.trigger('modal-destroyed');
                        $(this).remove();
                        // Keep class modal-open on body tag as long as open modals exist
                        if (Modal.instances.length > 0) {
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-73720-TriggerEventAfterModalWindowDismissed.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-73720-TriggerEventAfterModalWindowDismissed.rst
new file mode 100644 (file)
index 0000000..3fb1a48
--- /dev/null
@@ -0,0 +1,24 @@
+============================================================
+Feature: #73720 - Trigger event after modal window dismissed
+============================================================
+
+Description
+===========
+
+A new event ``modal-destroyed`` has been added that will be triggered after a modal window closed.
+
+
+Impact
+======
+
+Bind to the event ``modal-destroyed`` to achieve custom actions after the modal dismissed.
+
+Example code:
+
+.. code-block:: javascript
+
+       var $modal = Modal.confirm(); // stub code
+       $modal.on('modal-destroyed', function() {
+               // Reset the selection
+               $someCombobox.val('');
+       });
\ No newline at end of file