Related to issue 23761: Fixed leaks when Alerts iwndow is opened
authorAugusto Mauch <augusto.mauch@openbravo.com>
Fri, 10 May 2013 08:57:18 +0200
changeset 20306 253b5864e293
parent 20305 c8f69b3d8d6c
child 20307 2065f7a45897
Related to issue 23761: Fixed leaks when Alerts iwndow is opened
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-grid.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-management-view.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-grid.js	Thu May 09 15:56:54 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-grid.js	Fri May 10 08:57:18 2013 +0200
@@ -126,6 +126,14 @@
     this.Super('initWidget', arguments);
   },
 
+  destroy: function () {
+    if (this.contextMenu) {
+      this.contextMenu.destroy();
+      this.contextMenu = null;
+    }
+    this.Super('destroy', arguments);
+  },
+
   setDataSource: function (ds) {
     this.Super('setDataSource', [ds, this.gridFields]);
     // Some properties need to be set when the datasource is loaded to avoid errors when form is
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-management-view.js	Thu May 09 15:56:54 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-management-view.js	Fri May 10 08:57:18 2013 +0200
@@ -195,6 +195,52 @@
     this.sectionStack.addSection(this.sections.Solved);
   },
 
+  destroy: function () {
+    if (this.grids) {
+      if (this.grids.New) {
+        this.grids.New.destroy();
+        this.grids.New = null;
+      }
+      if (this.grids.Acknowledged) {
+        this.grids.Acknowledged.destroy();
+        this.grids.Acknowledged = null;
+      }
+      if (this.grids.Suppressed) {
+        this.grids.Suppressed.destroy();
+        this.grids.Suppressed = null;
+      }
+      if (this.grids.Solved) {
+        this.grids.Solved.destroy();
+        this.grids.Solved = null;
+      }
+    }
+    if (this.NewAcknowledged) {
+      this.NewAcknowledged.destroy();
+      this.NewAcknowledged = null;
+    }
+    if (this.NewSuppressed) {
+      this.NewSuppressed.destroy();
+      this.NewSuppressed = null;
+    }
+    if (this.AcknowledgedNew) {
+      this.AcknowledgedNew.destroy();
+      this.AcknowledgedNew = null;
+    }
+    if (this.AcknowledgedSuppressed) {
+      this.AcknowledgedSuppressed.destroy();
+      this.AcknowledgedSuppressed = null;
+    }
+    if (this.SuppressedNew) {
+      this.SuppressedNew.destroy();
+      this.SuppressedNew = null;
+    }
+    if (this.SuppressedAcknowledged) {
+      this.SuppressedAcknowledged.destroy();
+      this.SuppressedAcknowledged = null;
+    }
+    this.Super('destroy', arguments);
+  },
+
   moveToStatus: function (alertIDs, oldStatus, newStatus) {
     var post = {
       'eventType': 'moveToStatus',