annotate app/controller/Sql.js @ 28:4d60b9ebce15

Renamed sql modul into search. Further display The query selection as Combobox instead of a grid.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Thu, 16 May 2013 17:55:53 +0200
parents f964a50bfe57
children 897e3100c6da
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: [
28
4d60b9ebce15 Renamed sql modul into search. Further display The query selection as Combobox
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 25
diff changeset
4 'search.List'
6
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.
28
4d60b9ebce15 Renamed sql modul into search. Further display The query selection as Combobox
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 25
diff changeset
14 'queryselector': {
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.
28
4d60b9ebce15 Renamed sql modul into search. Further display The query selection as Combobox
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 25
diff changeset
18 select: this.selectSql
6
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 },
28
4d60b9ebce15 Renamed sql modul into search. Further display The query selection as Combobox
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 25
diff changeset
25 selectSql: function(element, record, index) {
4d60b9ebce15 Renamed sql modul into search. Further display The query selection as Combobox
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 25
diff changeset
26 //var selection = record.get('id');
4d60b9ebce15 Renamed sql modul into search. Further display The query selection as Combobox
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 25
diff changeset
27 var selection = index;
25
f964a50bfe57 Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 17
diff changeset
28 var variables = Ext.getCmp('variables');
f964a50bfe57 Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 17
diff changeset
29 var result = Ext.getCmp('result');
f964a50bfe57 Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 17
diff changeset
30 console.log('Selected SQL ' + selection);
f964a50bfe57 Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 17
diff changeset
31 //// 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
32 //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
33 //if (variables.items.length > 1) {
f964a50bfe57 Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 17
diff changeset
34 // console.log('Length is > than 1');
f964a50bfe57 Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 17
diff changeset
35 // variables.remove(currentVar.id);
f964a50bfe57 Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 17
diff changeset
36 //}
f964a50bfe57 Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 17
diff changeset
37 //if (selection == 1) {
f964a50bfe57 Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 17
diff changeset
38 // currentVar = variables1;
f964a50bfe57 Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 17
diff changeset
39 //}
f964a50bfe57 Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 17
diff changeset
40 //else {
f964a50bfe57 Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 17
diff changeset
41 // currentVar = variables2;
f964a50bfe57 Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 17
diff changeset
42 //}
f964a50bfe57 Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 17
diff changeset
43 //variables.add(currentVar);
f964a50bfe57 Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 17
diff changeset
44 //// 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
45 //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
46
3eaeeec2bb28 Changed layout and added Listeners to show the correct variable definition for
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 8
diff changeset
47 // Show the results.
28
4d60b9ebce15 Renamed sql modul into search. Further display The query selection as Combobox
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 25
diff changeset
48 console.log('Loading store');
25
f964a50bfe57 Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 17
diff changeset
49 result.getStore().load();
28
4d60b9ebce15 Renamed sql modul into search. Further display The query selection as Combobox
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 25
diff changeset
50 console.log('Store loaded');
25
f964a50bfe57 Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 17
diff changeset
51 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
52 }
8e79bda4d55b Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
53 });
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
54
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
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 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
57 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
58 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
59 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
60 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
61 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
62 };
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
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 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
65 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
66 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
67 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
68 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
69 };

http://lada.wald.intevation.org