From 475528d1b6d4fa8b58cd05d1a4d5b4f7e9d1d782 Mon Sep 17 00:00:00 2001
From: Renaud Le Gac <legac@cppm.in2p3.fr>
Date: Sat, 15 Dec 2012 09:48:50 +0100
Subject: [PATCH] Bug fix to avoid pop up window on the top left and proper
 initialisation of the master store

---
 static/plugin_dbui/src/linkedcombobox.js | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/static/plugin_dbui/src/linkedcombobox.js b/static/plugin_dbui/src/linkedcombobox.js
index 95b1fbec..61933663 100644
--- a/static/plugin_dbui/src/linkedcombobox.js
+++ b/static/plugin_dbui/src/linkedcombobox.js
@@ -52,15 +52,11 @@ App.form.LinkedComboBox = Ext.extend(Ext.form.ComboBox, {
                 fields: [this.displayField, this.valueField]
             });
 
-            if (!this.masterStore.getTotalCount()) {
-                this.masterStore.load({
-                    callback: this.loadMasterData, 
-                    scope: this
-                });
-                
-            } else {
-                this.loadMasterData();
-            }  
+            this.masterStore.restoreWhere()
+            this.masterStore.load({
+                callback: this.loadMasterData, 
+                scope: this
+            });                
         }
         
         // prepare the store for the slave role
@@ -118,9 +114,14 @@ App.form.LinkedComboBox = Ext.extend(Ext.form.ComboBox, {
         // To fix this issue, the code mimic the click by a user
         // on the slave combobox and then it works !!!
         //
+        // In some case a window on the top left appears with
+        // the content of the combobox. 
+        // The line combo.hasFocus is a protection against this case.
+        //
         
         function initialise(combo) {
             combo.onTriggerClick();
+            combo.hasFocus = false;
             combo.collapse();
             combo.reset();
             combo.disable();            
-- 
GitLab