Issue 18227: Move the destroy of dataSource to the form and grid
authorIván Perdomo <ivan.perdomo@openbravo.com>
Fri, 26 Aug 2011 15:00:34 +0200
changeset 13605 3823c5ec27a4
parent 13604 90094abfaff9
child 13606 cff2f670c700
Issue 18227: Move the destroy of dataSource to the form and grid
To avoid problems of setting/resetting flags (when the datasource needs to be
destroyed). This action is now in the OBFormView and OBViewGrid destroy
method.
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
--- a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Fri Aug 26 09:39:52 2011 +0200
+++ b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Fri Aug 26 15:00:34 2011 +0200
@@ -261,26 +261,6 @@
   setValueInField: function(){
     this.selector.setValueFromRecord(this.selectorGrid.getSelectedRecord(), true);
     this.hide();
-  },
-
-  destroy: function () {
-    // Destroy the selectorGrid to avoid memory leaks
-    if(this.selectorGrid) {
-      if(this.selectorGrid.dataSource &&
-         this.selector.form.destroyItemObjects) {
-        this.selectorGrid.dataSource.destroy();
-        this.selectorGrid.dataSource = null;
-      }
-      this.selectorGrid.destroy();
-      this.selectorGrid = null;
-    }
-
-    if(this.dataSource && this.selector.form.destroyItemObjects) {
-      this.dataSource.destroy();
-      this.dataSource = null;
-    }
-
-    this.Super('destroy', arguments);
   }
 });
 
@@ -634,14 +614,6 @@
       this.selectorWindow.destroy();
       this.selectorWindow = null;
     }
-
-    // Only destroy the optionDataSource if is allowed by the form
-    if(this.form.destroyItemObjects) {
-      if(this.optionDataSource) {
-        this.optionDataSource.destroy();
-        this.optionDataSource = null;
-      }
-    }
     this.Super('destroy', arguments);
   }
 });
@@ -819,14 +791,6 @@
       this.selectorWindow.destroy();
       this.selectorWindow = null;
     }
-
-    // Only destroy the optionDataSource if is allowed by the form
-    if(this.form.destroyItemObjects) {
-      if(this.optionDataSource) {
-        this.optionDataSource.destroy();
-        this.optionDataSource = null;
-      }
-    }
     this.Super('destroy', arguments);
   }
 });