diff app/controller/Sql.js @ 17:3eaeeec2bb28

Changed layout and added Listeners to show the correct variable definition for the selected sql query.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Tue, 30 Apr 2013 17:55:48 +0200
parents e4fcb4ddd782
children f964a50bfe57
line wrap: on
line diff
--- a/app/controller/Sql.js	Tue Apr 30 16:37:41 2013 +0200
+++ b/app/controller/Sql.js	Tue Apr 30 17:55:48 2013 +0200
@@ -11,7 +11,7 @@
         this.control({
             // CSS like selector to select element in the viewport. See
             // ComponentQuery documentation for more details.
-            'viewport > sqllist': {
+            'sqllist': {
                 // Map the "render" event to the given function.
                 render: this.onPanelRendered,
                 // Map Doubleclick on rows of the probenlist.
@@ -23,6 +23,42 @@
         console.log('The panel was rendered');
     },
     selectSql: function(grid, record) {
-        console.log('Selected SQL ' + record.get('id'));
+        var selection = record.get('id');
+        var variables = Ext.getCmp('searchVariables');
+        console.log('Selected SQL' + selection);
+        // Set correct form for the current SQL-Selection
+        console.log('Length is ' + variables.items.length);
+        if (variables.items.length > 1) {
+            console.log('Length is > than 1');
+            variables.remove(currentVar.id);
+        }
+        if (selection == 1) {
+            currentVar = variables1;
+        }
+        else {
+            currentVar = variables2;
+        }
+        variables.add(currentVar);
+        // Show the panel for the variable definiton.
+        variables.show();
+
+        // Show the results.
+        Ext.getCmp('searchResult').show();
     }
 });
+
+
+var currentVar = null;
+var variables1 = {
+    xtype: 'panel',
+    id: 'variable1',
+    border: false,
+    html: 'Variablen für Abfrage 1'
+};
+
+var variables2 = {
+    xtype: 'panel',
+    id: 'variable2',
+    border: false,
+    html: 'Variablen für Abfrage 2'
+};

http://lada.wald.intevation.org