on 02-23-2017 3:17 PM
Hello Experts,
there is a new property of sap.m.Dialog, called escapeHandler. Does anyone know, how-to use it? It is available since 1.44. We're on 1.44.7, but could not make it working. It is a property and not an event handler btw.
The Dialog.fragment.xml part:
<Dialog title="{i18n>chooseWS}" contentHeight="100%" contentWidth="100%" stretch="true" verticalScrolling="false" escapeHandler="mayTheForceBeWithMe">
The Controller:
this._oDialog = sap.ui.xmlfragment("xxx.xxx.xxxx.xxx.Dialog", this); this._oDialog.setModel(this.getModel("i18n"), "i18n");
this._oDialog.open();
...
mayTheForceBeWithMe: function(oPromise) {
if (!this.oFilterEntry || this.oFilterEntry.workspace == "") {
oPromise.reject(); } else {
oPromise.resolve();
}
},
...
Function mayTheForceBeWithMe is not invoked.
Thank you
Hello Atilla,
I checked the issue and i found that if the dialog is created in the XML Fragment then it does not work. Where as if it is created in javascript controller it works. I checked the code of Dialog controller and this is the code
if (typeof oEscapeHandler === 'function') {
// create a Promise to allow app developers to hook to the 'escape' event
// and prevent the closing of the dialog by executing the escape handler function they defined
new window.Promise(function (resolve, reject) {
oPromiseArgument.resolve = resolve;
oPromiseArgument.reject = reject;
that.currentPromise = oPromiseArgument;
oEscapeHandler(that._getPromiseWrapper());
})
.then(function (result) {
that.close();
})
.catch(function () {
jQuery.sap.log.info("Disallow dialog closing");
});
} else {
this.close();
}
So there the oEscapeHandler needs to be function . I think this could be a bug from why checks for the type , but yes the way for you to make it work is using in javascript controller .
Thanks and Regards,
Veera
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
11 | |
10 | |
8 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.