Keep private app objects if dialog gets destroyed

This commit is contained in:
Hadi Nategh 2021-04-20 15:30:46 +02:00
parent 1a72732c3d
commit c370941c51
5 changed files with 12 additions and 8 deletions

View File

@ -180,7 +180,7 @@ var et2_dialog = /** @class */ (function (_super) {
// Un-dialog the dialog
this.div.dialog("destroy");
if (this.template) {
this.template.clear();
this.template.clear(true);
this.template = null;
}
this.div = null;

View File

@ -286,7 +286,7 @@ export class et2_dialog extends et2_widget {
public static NO_BUTTON: number = 3;
div: JQuery = null;
template: any = null;
template: etemplate2 = null;
constructor(_parent?, _attrs? : WidgetConfig, _child? : object) {
super(_parent, _attrs, ClassWithAttributes.extendAttributes(et2_dialog._attributes, _child || {}));
@ -322,7 +322,7 @@ export class et2_dialog extends et2_widget {
this.div.dialog("destroy");
if (this.template) {
this.template.clear();
this.template.clear(true);
this.template = null;
}

View File

@ -173,8 +173,9 @@ var etemplate2 = /** @class */ (function () {
;
/**
* Clears the current instance.
* @param _keep_app_object keep app object
*/
etemplate2.prototype.clear = function () {
etemplate2.prototype.clear = function (_keep_app_object) {
jQuery(this._DOMContainer).trigger('clear');
// Remove any handlers on window (resize)
if (this.uniqueId) {
@ -203,7 +204,7 @@ var etemplate2 = /** @class */ (function () {
}
}
// If using a private app object, remove all of them
if (this.app_obj !== window.app) {
if (!_keep_app_object && this.app_obj !== window.app) {
for (var app_name in this.app_obj) {
if (this.app_obj[app_name] instanceof egw_app_1.EgwApp) {
this.app_obj[app_name].destroy();

View File

@ -224,8 +224,9 @@ export class etemplate2
/**
* Clears the current instance.
* @param _keep_app_object keep app object
*/
public clear()
public clear(_keep_app_object?:boolean)
{
jQuery(this._DOMContainer).trigger('clear');
@ -265,7 +266,7 @@ export class etemplate2
}
// If using a private app object, remove all of them
if(this.app_obj !== window.app)
if(!_keep_app_object && this.app_obj !== window.app)
{
for(const app_name in this.app_obj)
{

View File

@ -13,6 +13,8 @@
* @author Andreas Stöckel
*/
import {EgwApp} from "./egw_app";
/**
* Global egw object (for now created by the diverse JavaScript files) with a TypeScript interface
*/
@ -1297,7 +1299,7 @@ declare interface IegwAppLocal extends IegwWndLocal
declare function egw_getFramework() : any;
declare var chrome : any;
declare var InstallTrigger : any;
declare var app : {classes: any, [propName: string]: any};
declare var app : {classes: any, [propName: string]: EgwApp};
declare var egw_globalObjectManager : any;
declare var framework : any;
declare var egw_LAB : any;