API
User Interaction
The Popup can also be hidden when a user clicks outside it. To control this behavior of the Popup, use the hideOnOutsideClick property.
- $(function() {
- $("#popupContainer").dxPopup({
- title: "Popup Title",
- visible: true,
- hideOnOutsideClick: true
- });
- });
Events
To execute certain commands before or after the Popup was shown/hidden, handle the showing, shown, hiding or hidden event. If the event handling function is not going to be changed during the lifetime of the UI component, assign it to the corresponding onEventName property when you configure the UI component.
- $(function () {
- $("#popupContainer").dxPopup({
- // ...
- onShowing: function (e) {
- // Handler of the "showing" event
- },
- onShown: function (e) {
- // Handler of the "shown" event
- },
- onHiding: function (e) {
- // Handler of the "hiding" event
- },
- onHidden: function (e) {
- // Handler of the "hidden" event
- }
- });
- });
If you are going to change event handlers at runtime, or if you need to attach several handlers to a single event, subscribe to the events using the on(eventName, eventHandler) method.
- const hiddenEventHandler1 = function (e) {
- // First handler of the "hidden" event
- };
- const hiddenEventHandler2 = function (e) {
- // Second handler of the "hidden" event
- };
- $("#popupContainer").dxPopup("instance")
- .on("hidden", hiddenEventHandler1)
- .on("hidden", hiddenEventHandler2);