comparison app/controller/Sql.js @ 31:897e3100c6da

Changed logic of the Probenauswahl. Now logic works like the BFS version.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Tue, 21 May 2013 17:53:51 +0200
parents 4d60b9ebce15
children a35119566841
comparison
equal deleted inserted replaced
30:c684f01c0b72 31:897e3100c6da
1 var queries = new Array('query1', 'query2');
1 Ext.define('Lada.controller.Sql', { 2 Ext.define('Lada.controller.Sql', {
2 extend: 'Ext.app.Controller', 3 extend: 'Ext.app.Controller',
3 views: [ 4 views: [
4 'search.List' 5 'search.List'
5 ], 6 ],
9 init: function() { 10 init: function() {
10 console.log('Initialising the Sql controller'); 11 console.log('Initialising the Sql controller');
11 this.control({ 12 this.control({
12 // CSS like selector to select element in the viewport. See 13 // CSS like selector to select element in the viewport. See
13 // ComponentQuery documentation for more details. 14 // ComponentQuery documentation for more details.
14 'queryselector': { 15 '#search': {
15 // Map the "render" event to the given function. 16 // Map the "render" event to the given function.
16 render: this.onPanelRendered, 17 render: this.onPanelRendered,
17 // Map Doubleclick on rows of the probenlist. 18 // Map Doubleclick on rows of the probenlist.
18 select: this.selectSql 19 select: this.selectSql
20 },
21 '#SearchBtn': {
22 // Map click event on Button.
23 click: this.search
24 },
25 '#ResetBtn': {
26 // Map click event on Button.
27 click: this.reset
19 } 28 }
20 }); 29 });
21 }, 30 },
22 onPanelRendered: function() { 31 onPanelRendered: function() {
23 console.log('The panel was rendered'); 32 console.log('The panel was rendered');
24 }, 33 },
25 selectSql: function(element, record, index) { 34 selectSql: function(element, record, index) {
26 //var selection = record.get('id'); 35 var selection = element.getValue() - 1;
27 var selection = index; 36 console.log('Selected SQL ' + selection);
28 var variables = Ext.getCmp('variables'); 37 for (var i = 0; i < queries.length; ++i) {
38 var toHide = Ext.getCmp(queries[i]);
39 toHide.hide();
40 }
41 var toShow = Ext.getCmp(queries[selection]);
42 var buttons = Ext.getCmp('SearchBtnPanel');
43 this.reset();
44 toShow.show();
45 buttons.show();
46 },
47 search: function(element, record, index) {
29 var result = Ext.getCmp('result'); 48 var result = Ext.getCmp('result');
30 console.log('Selected SQL ' + selection);
31 //// Set correct form for the current SQL-Selection
32 //console.log('Length is ' + variables.items.length);
33 //if (variables.items.length > 1) {
34 // console.log('Length is > than 1');
35 // variables.remove(currentVar.id);
36 //}
37 //if (selection == 1) {
38 // currentVar = variables1;
39 //}
40 //else {
41 // currentVar = variables2;
42 //}
43 //variables.add(currentVar);
44 //// Show the panel for the variable definiton.
45 //variables.show();
46
47 // Show the results.
48 console.log('Loading store'); 49 console.log('Loading store');
49 result.getStore().load(); 50 result.getStore().load();
50 console.log('Store loaded'); 51 console.log('Store loaded');
51 result.show(); 52 result.show();
53 },
54 reset: function(element, record, index) {
55 var buttons = Ext.getCmp('SearchBtnPanel');
56 var result = Ext.getCmp('result');
57 for (var i = 0; i < queries.length; ++i) {
58 var toHide = Ext.getCmp(queries[i]);
59 toHide.hide();
60 }
61 result.hide();
62 buttons.hide();
52 } 63 }
53 }); 64 });
54
55
56 var currentVar = null;
57 var variables1 = {
58 xtype: 'panel',
59 id: 'variable1',
60 border: false,
61 html: 'Variablen für Abfrage 1'
62 };
63
64 var variables2 = {
65 xtype: 'panel',
66 id: 'variable2',
67 border: false,
68 html: 'Variablen für Abfrage 2'
69 };

http://lada.wald.intevation.org