Load and control pop-up dialogs

Technologies > Software Engineering Techniques > Software Engineer Views > Load and Control Pop-up Dialogs

The parameters passed to View.openDialog() may include auto-wired functions for the dialog such as afterViewLoad and afterInitialDataFetch . In this example, afterViewLoad assigns a callback function to the dialog's onClose event. Note that the dialog controller can be obtained by calling controllers.get() from the dialog view. An explicit reference to the current controller is assigned to the variable thisController , which can then used in the callback function to reference the opener's controller:

var thisController = this;
var dialog = View.openDialog('ab-ex-prg-dialog.axvw', null, false, {
closeButton: false,
maximize: true,

afterViewLoad: function(dialogView) {
// access the dialog controller property
var dialogController = dialogView.controllers.get('dialog');
View.showMessage('dialog controller property = [' + dialogController.property + ']');
// set the dialog controller onClose callback
dialogController.onClose = thisController.dialog_onClose.createDelegate(thisController);
},

afterInitialDataFetch: function(dialogView) {
...
}
});


From the dialog, one may obtain a reference to the opener controller and access properties defined in the opener:

var openerController = View.getOpenerView().controllers.get('opener');
var property = openerController.property;


View.showMessage() opens a message dialog. A callback function may be assigned to a message dialog, and is called after the message dialog is closed:

View.showMessage('message', message, null, null,
// this callback function will be called after the message dialog is closed
function() {
alert('The message dialog was closed');
}
);

JavaScript API Reference/Ab.view.View object

JavaScript API Reference/Ab.view.View object

View: http://localhost:8080/archibus/schema/ab-products/solutions/programming/dialog/ab-ex-prg-opener.axvw