Fixes issue 18150: Destroy context menu when a listgrid is destroyed
authorMartin Taal <martin.taal@openbravo.com>
Mon, 01 Aug 2011 16:57:41 +0200
changeset 13365 19135e59b532
parent 13364 48ce4704f0dc
child 13366 d2e5daf7691b
Fixes issue 18150: Destroy context menu when a listgrid is destroyed
Added explicit destroy of context menu when a grid is destroyed
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Mon Aug 01 16:48:15 2011 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Mon Aug 01 16:57:41 2011 +0200
@@ -291,6 +291,17 @@
     return ret;
   },
 
+  // destroy the context menu also
+  // see why this needs to be done in the 
+  // documentation of canvas.contextMenu in Canvas.js
+  destroy: function() {
+    if (this.contextMenu) {
+      this.contextMenu.destroy();
+      this.contextMenu = null;
+    }
+    this.Super('destroy', arguments);
+  },
+  
   setData: function(data) {
     data.grid = this;
     this.Super('setData', arguments);