Fixes issue 18227: Move the destroy pane to OBTabSetMain
authorIván Perdomo <ivan.perdomo@openbravo.com>
Fri, 19 Aug 2011 09:32:54 +0200
changeset 13562 aac7c824b2be
parent 13561 c47e5c553628
child 13563 5deae7f7af43
Fixes issue 18227: Move the destroy pane to OBTabSetMain
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-tab.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-view-manager.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-tab.js	Fri Aug 19 01:50:29 2011 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-tab.js	Fri Aug 19 09:32:54 2011 +0200
@@ -284,6 +284,17 @@
     this.Super('removeTabs', [toRemove]);
     OB.Layout.HistoryManager.updateHistory();
     return true;
+  },
+
+  updateTab: function (tab, pane) {
+    var previousPane = tab && pane && tab.pane;
+    // Note: updateTab doesn't remove the previous loading tab
+    // http://www.smartclient.com/docs/8.1/a/b/c/go.html#method..TabSet.updateTab
+    if(previousPane) {
+      previousPane.destroy();
+      previousPane = null;
+    }
+    this.Super('updateTab', arguments);
   }
 });
 
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-view-manager.js	Fri Aug 19 01:50:29 2011 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-view-manager.js	Fri Aug 19 09:32:54 2011 +0200
@@ -330,21 +330,13 @@
           // eventhough there is already an open tab
           // still refresh it
           if (viewTabId !== null) {
-            loadingPane = tabSet.getTab(viewTabId) && tabSet.getTab(viewTabId).pane;
 
             // refresh the view
-            // Note: updateTab doesn't remove the previous loading tab
-            // http://www.smartclient.com/docs/8.1/a/b/c/go.html#method..TabSet.updateTab
             tabSet.updateTab(viewTabId, viewInstance);
 
             // and show it
             tabSet.selectTab(viewTabId);
 
-            // Destroying the loading tab
-            if(loadingPane && !viewInstance.myOB) {
-              loadingPane.destroy();
-            }
-
             // tell the viewinstance what tab it is on
             // note do not use tabId on the viewInstance
             // as tabId is used by the classic ob window