comparison 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
comparison
equal deleted inserted replaced
16:4faac2a04345 17:3eaeeec2bb28
9 init: function() { 9 init: function() {
10 console.log('Initialising the Sql controller'); 10 console.log('Initialising the Sql controller');
11 this.control({ 11 this.control({
12 // CSS like selector to select element in the viewport. See 12 // CSS like selector to select element in the viewport. See
13 // ComponentQuery documentation for more details. 13 // ComponentQuery documentation for more details.
14 'viewport > sqllist': { 14 'sqllist': {
15 // Map the "render" event to the given function. 15 // Map the "render" event to the given function.
16 render: this.onPanelRendered, 16 render: this.onPanelRendered,
17 // Map Doubleclick on rows of the probenlist. 17 // Map Doubleclick on rows of the probenlist.
18 itemclick: this.selectSql 18 itemclick: this.selectSql
19 } 19 }
21 }, 21 },
22 onPanelRendered: function() { 22 onPanelRendered: function() {
23 console.log('The panel was rendered'); 23 console.log('The panel was rendered');
24 }, 24 },
25 selectSql: function(grid, record) { 25 selectSql: function(grid, record) {
26 console.log('Selected SQL ' + record.get('id')); 26 var selection = record.get('id');
27 var variables = Ext.getCmp('searchVariables');
28 console.log('Selected SQL' + selection);
29 // Set correct form for the current SQL-Selection
30 console.log('Length is ' + variables.items.length);
31 if (variables.items.length > 1) {
32 console.log('Length is > than 1');
33 variables.remove(currentVar.id);
34 }
35 if (selection == 1) {
36 currentVar = variables1;
37 }
38 else {
39 currentVar = variables2;
40 }
41 variables.add(currentVar);
42 // Show the panel for the variable definiton.
43 variables.show();
44
45 // Show the results.
46 Ext.getCmp('searchResult').show();
27 } 47 }
28 }); 48 });
49
50
51 var currentVar = null;
52 var variables1 = {
53 xtype: 'panel',
54 id: 'variable1',
55 border: false,
56 html: 'Variablen für Abfrage 1'
57 };
58
59 var variables2 = {
60 xtype: 'panel',
61 id: 'variable2',
62 border: false,
63 html: 'Variablen für Abfrage 2'
64 };

http://lada.wald.intevation.org