Mercurial > lada > lada-client
annotate app/controller/Sql.js @ 25:f964a50bfe57
Restructured the application. Fixed layouts etc.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Wed, 08 May 2013 12:20:06 +0200 |
parents | 3eaeeec2bb28 |
children | 4d60b9ebce15 |
rev | line source |
---|---|
6
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
1 Ext.define('Lada.controller.Sql', { |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
2 extend: 'Ext.app.Controller', |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
3 views: [ |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
4 'sql.List' |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
5 ], |
8
e4fcb4ddd782
Moved stored SQL into its own file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
6
diff
changeset
|
6 stores: [ |
e4fcb4ddd782
Moved stored SQL into its own file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
6
diff
changeset
|
7 'Sql' |
e4fcb4ddd782
Moved stored SQL into its own file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
6
diff
changeset
|
8 ], |
6
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
9 init: function() { |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
10 console.log('Initialising the Sql controller'); |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
11 this.control({ |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
12 // CSS like selector to select element in the viewport. See |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
13 // ComponentQuery documentation for more details. |
17
3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
8
diff
changeset
|
14 'sqllist': { |
6
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
15 // Map the "render" event to the given function. |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
16 render: this.onPanelRendered, |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
17 // Map Doubleclick on rows of the probenlist. |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
18 itemclick: this.selectSql |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
19 } |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
20 }); |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
21 }, |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
22 onPanelRendered: function() { |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
23 console.log('The panel was rendered'); |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
24 }, |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
25 selectSql: function(grid, record) { |
17
3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
8
diff
changeset
|
26 var selection = record.get('id'); |
25
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
27 var variables = Ext.getCmp('variables'); |
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
28 var result = Ext.getCmp('result'); |
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
29 console.log('Selected SQL ' + selection); |
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
30 //// Set correct form for the current SQL-Selection |
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
31 //console.log('Length is ' + variables.items.length); |
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
32 //if (variables.items.length > 1) { |
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
33 // console.log('Length is > than 1'); |
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
34 // variables.remove(currentVar.id); |
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
35 //} |
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
36 //if (selection == 1) { |
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
37 // currentVar = variables1; |
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
38 //} |
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
39 //else { |
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
40 // currentVar = variables2; |
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
41 //} |
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
42 //variables.add(currentVar); |
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
43 //// Show the panel for the variable definiton. |
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
44 //variables.show(); |
17
3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
8
diff
changeset
|
45 |
3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
8
diff
changeset
|
46 // Show the results. |
25
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
47 result.getStore().load(); |
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
48 result.show(); |
6
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
49 } |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
50 }); |
17
3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
8
diff
changeset
|
51 |
3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
8
diff
changeset
|
52 |
3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
8
diff
changeset
|
53 var currentVar = null; |
3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
8
diff
changeset
|
54 var variables1 = { |
3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
8
diff
changeset
|
55 xtype: 'panel', |
3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
8
diff
changeset
|
56 id: 'variable1', |
3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
8
diff
changeset
|
57 border: false, |
3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
8
diff
changeset
|
58 html: 'Variablen für Abfrage 1' |
3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
8
diff
changeset
|
59 }; |
3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
8
diff
changeset
|
60 |
3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
8
diff
changeset
|
61 var variables2 = { |
3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
8
diff
changeset
|
62 xtype: 'panel', |
3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
8
diff
changeset
|
63 id: 'variable2', |
3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
8
diff
changeset
|
64 border: false, |
3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
8
diff
changeset
|
65 html: 'Variablen für Abfrage 2' |
3eaeeec2bb28
Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
8
diff
changeset
|
66 }; |