Avoid errors from close confirm changes if button is not fully created.

This commit is contained in:
nathangray 2020-06-29 10:54:14 -06:00
parent 8cb3b228ca
commit a50ede7967
2 changed files with 5 additions and 4 deletions

View File

@ -195,12 +195,13 @@ var et2_button = /** @class */ (function (_super) {
* @returns {Boolean}
*/
et2_button.prototype.click = function (_ev) {
var _a, _b;
// ignore click on readonly button
if (this.options.readonly)
return false;
this.clicked = true;
// Cancel buttons don't trigger the close confirmation prompt
if (this.btn.hasClass("et2_button_cancel")) {
if ((_a = this.btn) === null || _a === void 0 ? void 0 : _a.hasClass("et2_button_cancel")) {
this.getInstanceManager().skip_close_prompt();
}
if (!_super.prototype.click.apply(this, arguments)) {
@ -212,7 +213,7 @@ var et2_button = /** @class */ (function (_super) {
this.getInstanceManager().submit(this, false, this.options.novalidate); //TODO: this only needs to be passed if it's in a datagrid
}
this.clicked = false;
this.getInstanceManager().skip_close_prompt(false);
(_b = this.getInstanceManager()) === null || _b === void 0 ? void 0 : _b.skip_close_prompt(false);
return true;
};
et2_button.prototype.set_label = function (_value) {

View File

@ -311,7 +311,7 @@ export class et2_button extends et2_baseWidget implements et2_IInput, et2_IDetac
this.clicked = true;
// Cancel buttons don't trigger the close confirmation prompt
if(this.btn.hasClass("et2_button_cancel"))
if(this.btn?.hasClass("et2_button_cancel"))
{
this.getInstanceManager().skip_close_prompt();
}
@ -328,7 +328,7 @@ export class et2_button extends et2_baseWidget implements et2_IInput, et2_IDetac
this.getInstanceManager().submit(this, false, this.options.novalidate); //TODO: this only needs to be passed if it's in a datagrid
}
this.clicked = false;
this.getInstanceManager().skip_close_prompt(false);
this.getInstanceManager()?.skip_close_prompt(false);
return true;
}