Mercurial > lada > lada-client
annotate app/controller/Filter.js @ 1018:418e25969a16
Serve roles on different ports for easier testing.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 04 Feb 2016 14:16:43 +0100 |
parents | d6e259e76de6 |
children | f4bd170f8ee6 |
rev | line source |
---|---|
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 * |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 */ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 /** |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 * Controller for the Filter |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 * This controller handles all logic related to the filter |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 */ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 Ext.define('Lada.controller.Filter', { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 extend: 'Ext.app.Controller', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 requires: [ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 'Lada.view.widget.Messstelle', |
1015
af9879d72310
Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1008
diff
changeset
|
18 'Lada.view.window.FilterManagement', |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 'Lada.view.widget.Umwelt' |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 ], |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 stores: [ |
908
96e04c258b8f
Fixed Code to correct minified js
Dustin Demuth <dustin@intevation.de>
parents:
882
diff
changeset
|
23 'ProbenList', // List of found Proben |
96e04c258b8f
Fixed Code to correct minified js
Dustin Demuth <dustin@intevation.de>
parents:
882
diff
changeset
|
24 'MessprogrammeList' //List of found Messprogramme |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 ], |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 |
734
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
27 displayFields: null, |
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
28 |
1015
af9879d72310
Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1008
diff
changeset
|
29 managementWindow: null, |
af9879d72310
Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1008
diff
changeset
|
30 |
af9879d72310
Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1008
diff
changeset
|
31 mode: 'proben', |
af9879d72310
Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1008
diff
changeset
|
32 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
33 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
34 * Initialize this Controller |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
35 * It has 4 Listeners |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
36 */ |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 init: function() { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 this.control({ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 // CSS like selector to select element in the viewport. See |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 // ComponentQuery documentation for more details. |
994
092e245b13a4
draft implementation of the status-reset function: Todo: move this into a 'confirmation dialog'
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
41 'filterpanel combobox[name=filter]': { |
794
bc6bc71efb78
Preselect Proben in PPS, Preselect the first entry in the Filter Combobox
Dustin Demuth <dustin@intevation.de>
parents:
792
diff
changeset
|
42 // Map Select event |
882 | 43 select: this.selectSql |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 }, |
994
092e245b13a4
draft implementation of the status-reset function: Todo: move this into a 'confirmation dialog'
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
45 'filterpanel button[action=search]': { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 // Map click event on Button. |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 click: this.search |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 }, |
994
092e245b13a4
draft implementation of the status-reset function: Todo: move this into a 'confirmation dialog'
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
49 'filterpanel button[action=reset]': { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 // Map click event on Button. |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 click: this.reset |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 }, |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
53 'filterpanel button[action=details]': { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
54 click: this.showDetails |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
55 }, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
56 'filterpanel button[action=manage]': { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
57 click: this.showManagement |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
58 }, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
59 'filterpanel checkbox[name=favorites]': { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
60 change: this.triggerFilterUpdate |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
61 }, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
62 'filterpanel button[action=savedefault]': { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
63 click: this.saveFilterDefaults |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
64 }, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
65 'filterpanel button[action=resetdefault]': { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
66 click: this.resetFilterDefaults |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
67 }, |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 'menuitem[action=about]': { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 // Map click event on Button. |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 click: this.about |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 this.callParent(arguments); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 /** |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 * Function called when the user selects a SQL query in the dropdownlist. |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 * The function will hide/display additional element related to the |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
79 * selected search query. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
80 * It also replaces the Store of the Filteresultgrid. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
81 * Two possibilities exist to do so: Proben/Messprogramme where dynamic columns exist, but the |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
82 * content remains of the same type and Stammdaten, were columns are fixed but the type might |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
83 * vary between orte, kategorien, ... |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 */ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 selectSql: function(element, record) { |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
86 var filters = element.up('panel[name=main]').down('panel[name=filtervariables]'); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
87 var filterValues = element.up('panel[name=main]').down('panel[name=filtervalues]'); |
979 | 88 |
1015
af9879d72310
Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1008
diff
changeset
|
89 if (!record[0]) { |
af9879d72310
Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1008
diff
changeset
|
90 return; |
af9879d72310
Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1008
diff
changeset
|
91 } |
979 | 92 // Set "Filter Auswahl" Description |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 var desc = element.up('fieldset').down('displayfield[name=description]'); |
979 | 94 desc.setValue(record[0].data.description); |
95 | |
734
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
96 this.displayFields = record[0].data.results; |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 var filterFields = record[0].data.filters; |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
98 var contentPanel = element.up('panel[name=main]').down('panel[name=contentpanel]'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
99 var queryType = record[0].get('type'); //The type of the query, might be proben, messprogramme, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
100 // or a stammdatendtype |
1015
af9879d72310
Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1008
diff
changeset
|
101 var details = element.up('panel[name=main]').down('filterdetails'); |
af9879d72310
Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1008
diff
changeset
|
102 details.setRecord(record[0]); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 |
734
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
104 this.reset(element); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
105 |
979 | 106 contentPanel.removeAll(); //clear the panel: make space for new grids |
107 | |
108 // Setup Columns | |
109 if (this.displayFields) { | |
110 this.displayFields.reverse(); | |
111 } | |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
112 |
981
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
113 if (queryType == 'probe' || queryType == 'messprogramm') { |
979 | 114 // Dynamic Grids |
115 // We need to set both grid and Store. | |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
116 var frgrid; // The Resultgrid |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
117 var gridstore; // The Store which will be used in the resultgrid. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
118 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
119 switch (queryType) { |
981
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
120 case 'probe': |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
121 gridstore = Ext.create('Lada.store.ProbenList'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
122 frgrid = Ext.create('Lada.view.grid.ProbeList'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
123 break; |
981
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
124 case 'messprogramm': |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
125 gridstore = Ext.create('Lada.store.MessprogrammeList'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
126 frgrid = Ext.create('Lada.view.grid.MessprogrammeList'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
127 break; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
128 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
129 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
130 if (gridstore) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
131 frgrid.setStore(gridstore); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
132 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
133 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
134 contentPanel.add(frgrid); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
135 } |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
136 else { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
137 // Grids which are not build with dynamic columns |
979 | 138 // The store is configured in each grid, hence we only need to set the |
139 // grid | |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
140 var resultGrid; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
141 switch (queryType) { |
981
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
142 case 'messprogrammkategorie': |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
143 resultGrid = Ext.create('Lada.view.grid.MessprogrammKategorie'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
144 break; |
981
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
145 case 'datensatzerzeuger': |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
146 resultGrid = Ext.create('Lada.view.grid.DatensatzErzeuger'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
147 break; |
981
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
148 case 'ort': |
1004
9ac03f461ab4
Introduced Orte into Stammdatengrids, Added Ortszuordnung. THIS COMMIT IS WORK IN PROGRESS, Proben will NOT work after this commit. Orte can not be edited.
Dustin Demuth <dustin@intevation.de>
parents:
983
diff
changeset
|
149 resultGrid = Ext.create('Lada.view.grid.Orte'); |
981
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
150 break; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
151 case 'probenehmer': |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
152 resultGrid = Ext.create('Lada.view.grid.Probenehmer'); |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
153 break; |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
154 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
155 if (resultGrid) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
156 contentPanel.add(resultGrid); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
157 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
158 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
159 /* Setup Filters |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
160 * |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
161 * Allowed types are |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
162 * * text |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
163 * * number |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
164 * * datetime |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
165 * * bool |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
166 * * listmst |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
167 * * listumw |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
168 * * listver |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
169 * * listdbasis |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
170 * * listnetz |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
171 * |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
172 * Iterate over all configured filters and add filters dynamically |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
173 * |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
174 * 1. Empty filters |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
175 */ |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
176 filterValues.removeAll(); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
177 var hide = true; |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
178 /* 2. Iterate over all configured filters */ |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
179 var j; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
180 for (j = 0; j < filterFields.length; j++) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
181 var type = filterFields[j].type; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
182 var name = filterFields[j].dataIndex; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
183 var label = filterFields[j].label; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
184 var multi = filterFields[j].multiSelect; |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
185 var filterId = filterFields[j].id; |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
186 var field = null; |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
187 var value = filterFields[j].value; |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
188 if (type === 'text') { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
189 field = Ext.create('Ext.form.field.Text', { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
190 name: name, |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
191 fieldLabel: label, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
192 filterId: filterId, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
193 value: value |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
194 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
195 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
196 else if (type === 'number') { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
197 field = Ext.create('Ext.form.field.Number', { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
198 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
199 labelWidth: 135, |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
200 fieldLabel: label, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
201 filterId: filterId, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
202 value: value |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
203 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
204 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
205 else if (type === 'datetime') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
206 field = Ext.create('Lada.view.widget.Datetime', { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
207 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
208 labelWidth: 135, |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
209 fieldLabel: label, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
210 filterId: filterId, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
211 value: value |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
212 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
213 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
214 else if (type === 'bool') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
215 field = Ext.create('Lada.view.widget.Testdatensatz', { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
216 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
217 labelWidth: 135, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
218 fieldLabel: label, |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
219 value: value, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
220 filterId: filterId, |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
221 emptyText: '' |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
222 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
223 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
224 else if (type === 'listmst') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
225 field = Ext.create('Lada.view.widget.Messstelle', { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
226 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
227 labelWidth: 135, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
228 fieldLabel: label, |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
229 multiSelect: multi, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
230 filterId: filterId, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
231 value: value |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
232 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
233 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
234 else if (type === 'listumw') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
235 field = Ext.create('Lada.view.widget.Umwelt', { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
236 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
237 labelWidth: 135, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
238 fieldLabel: label, |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
239 value: value, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
240 filterId: filterId, |
874
031b4431b1b8
Applied Patch which was presented in the Workshop: Umweltbereich ComboBox in shall not show the name of the umweltbereich
Dustin Demuth <dustin@intevation.de>
parents:
844
diff
changeset
|
241 multiSelect: multi, |
031b4431b1b8
Applied Patch which was presented in the Workshop: Umweltbereich ComboBox in shall not show the name of the umweltbereich
Dustin Demuth <dustin@intevation.de>
parents:
844
diff
changeset
|
242 displayTpl: Ext.create('Ext.XTemplate', |
031b4431b1b8
Applied Patch which was presented in the Workshop: Umweltbereich ComboBox in shall not show the name of the umweltbereich
Dustin Demuth <dustin@intevation.de>
parents:
844
diff
changeset
|
243 '<tpl for=".">{id} </tpl>') |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
244 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
245 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
246 else if (type === 'listdbasis') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
247 field = Ext.create('Lada.view.widget.Datenbasis', { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
248 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
249 labelWidth: 135, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
250 fieldLabel: label, |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
251 value: value, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
252 filterId: filterId, |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
253 multiSelect: multi |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
254 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
255 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
256 else if (type === 'listver') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
257 field = Ext.create('Lada.view.widget.Verwaltungseinheit', { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
258 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
259 labelWidth: 135, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
260 fieldLabel: label, |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
261 value: value, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
262 filterId: filterId, |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
263 multiSelect: multi |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
264 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
265 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
266 else if (type === 'listnetz') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
267 field = Ext.create('Lada.view.widget.Netzbetreiber', { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
268 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
269 labelWidth: 135, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
270 fieldLabel: label, |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
271 value: value, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
272 filterId: filterId, |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
273 multiSelect: multi |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
274 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
275 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
276 if (field) { |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
277 filterValues.add(field); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
278 filters.show(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
279 hide = false; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
280 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
281 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
282 if (hide) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
283 filters.hide(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
284 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
285 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
286 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
287 /** |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
288 * Function is called when the user clicks the search button. The function |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
289 * will perform a search to the server on refreshes the result list. |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
290 * To do so it replaces the store of the Resultgrids. |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
291 */ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
292 search: function(element) { |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
293 var resultGrid = element.up('panel[name=main]').down('panel[name=contentpanel]').down('grid'); |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
294 var filters = element.up('panel[name=main]').down('panel[name=filtervalues]'); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
295 var search = element.up('fieldset').down('combobox[name=filter]'); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
296 |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
297 //Type of the search Proben/Messprogramme/Stammdaten |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
298 var type = search.store.getById(search.getValue()).get('type'); |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
299 |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
300 // Get search parameters: |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
301 var searchParams = {}; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
302 searchParams['qid'] = search.getValue(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
303 for (var i = filters.items.length - 1; i >= 0; i--) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
304 var filter = filters.items.items[i]; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
305 var value = filter.getValue(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
306 if (value instanceof Array) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
307 value = value.join(','); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
308 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
309 searchParams[filter.getName()] = value; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
310 } |
751
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
311 |
981
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
312 //Store depends of the Type... |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
313 // TODO the switchcasese should be unified withj those in SelectSql |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
314 switch (type) { |
983 | 315 case 'probe': |
981
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
316 sname = 'Lada.store.ProbenList'; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
317 break; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
318 case 'messprogramm': |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
319 sname = 'Lada.store.MessprogrammeList'; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
320 break; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
321 case 'messprogrammkategorie': |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
322 sname = 'Lada.store.MessprogrammKategorie'; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
323 break; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
324 case 'datensatzerzeuger': |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
325 sname = 'Lada.store.DatensatzErzeuger'; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
326 break; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
327 case 'ort': |
1004
9ac03f461ab4
Introduced Orte into Stammdatengrids, Added Ortszuordnung. THIS COMMIT IS WORK IN PROGRESS, Proben will NOT work after this commit. Orte can not be edited.
Dustin Demuth <dustin@intevation.de>
parents:
983
diff
changeset
|
328 sname = 'Lada.store.Orte'; |
981
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
329 break; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
330 case 'probenehmer': |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
331 sname = 'Lada.store.Probenehmer'; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
332 break; |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
333 } |
751
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
334 |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
335 // Find the store or create a new one. |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
336 var store = Ext.StoreManager.lookup(sname); |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
337 if (!store) { |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
338 store = Ext.create(sname); |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
339 } |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
340 if (store) { |
810
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
341 store.addListener('beforeload', this.loadingAnimationOn, resultGrid); |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
342 store.addListener('load', this.loadingAnimationOff, resultGrid); |
976
3c770fc7cf19
Added a variable which makes it possible to detect if a grid is dynamic
Dustin Demuth <dustin@intevation.de>
parents:
975
diff
changeset
|
343 |
751
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
344 resultGrid.setStore(store); |
976
3c770fc7cf19
Added a variable which makes it possible to detect if a grid is dynamic
Dustin Demuth <dustin@intevation.de>
parents:
975
diff
changeset
|
345 //TODO: Check if this is still necessary, as a Grid exists |
3c770fc7cf19
Added a variable which makes it possible to detect if a grid is dynamic
Dustin Demuth <dustin@intevation.de>
parents:
975
diff
changeset
|
346 // for each Type. |
3c770fc7cf19
Added a variable which makes it possible to detect if a grid is dynamic
Dustin Demuth <dustin@intevation.de>
parents:
975
diff
changeset
|
347 |
3c770fc7cf19
Added a variable which makes it possible to detect if a grid is dynamic
Dustin Demuth <dustin@intevation.de>
parents:
975
diff
changeset
|
348 if (resultGrid.isDynamic) { |
3c770fc7cf19
Added a variable which makes it possible to detect if a grid is dynamic
Dustin Demuth <dustin@intevation.de>
parents:
975
diff
changeset
|
349 //only the dynamic resultgrid can and needs to do the following: |
3c770fc7cf19
Added a variable which makes it possible to detect if a grid is dynamic
Dustin Demuth <dustin@intevation.de>
parents:
975
diff
changeset
|
350 resultGrid.setupColumns(this.displayFields); |
3c770fc7cf19
Added a variable which makes it possible to detect if a grid is dynamic
Dustin Demuth <dustin@intevation.de>
parents:
975
diff
changeset
|
351 } |
3c770fc7cf19
Added a variable which makes it possible to detect if a grid is dynamic
Dustin Demuth <dustin@intevation.de>
parents:
975
diff
changeset
|
352 |
751
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
353 resultGrid.getStore().proxy.extraParams = searchParams; |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
354 resultGrid.getStore().load(); |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
355 resultGrid.show(); |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
356 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
357 }, |
810
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
358 |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
359 /** |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
360 * Enable the Loading Animation of the Grid. |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
361 */ |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
362 loadingAnimationOn: function(store, operation) { |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
363 // this = resultgrid because of the scope which was set in addListener |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
364 this.setLoading(true); |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
365 }, |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
366 |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
367 /** |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
368 * Disable the Loading Animation of the Grid. |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
369 */ |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
370 loadingAnimationOff: function(store, operation) { |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
371 // this = resultgrid because of the scope which was set in addListener |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
372 this.setLoading(false); |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
373 }, |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
374 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
375 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
376 * This function resets the filters |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
377 */ |
734
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
378 reset: function(element) { |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
379 var filters = element.up('panel[name=main]').down('panel[name=filtervalues]'); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
380 var search = element.up('fieldset').down('combobox[name=filter]'); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
381 |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
382 //Type of the search Proben/Messprogramme/Stammdaten |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
383 var qId = search.getValue(); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
384 var query = search.store.getById(qId); |
734
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
385 for (var i = filters.items.length - 1; i >= 0; i--) { |
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
386 var filter = filters.items.items[i]; |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
387 for (var j = 0; j < query.data.filters.length; j++) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
388 if (filter.filterId === query.data.filters[j].id) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
389 filter.setValue(query.data.filters[j].value); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
390 } |
844
1449d58d6f58
Clear the text filter correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
810
diff
changeset
|
391 } |
734
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
392 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
393 }, |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
394 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
395 * This Function is supposed to handle the About action |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
396 * It has no function yet. |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
397 */ |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
398 about: function() { |
800
4b9b1d3ad9f1
Added about window, There are still some todos when retrieving the server version, the asynchronous request seems to fail and does not evaluate in time
Dustin Demuth <dustin@intevation.de>
parents:
794
diff
changeset
|
399 var win = Ext.create('Lada.view.window.About'); |
4b9b1d3ad9f1
Added about window, There are still some todos when retrieving the server version, the asynchronous request seems to fail and does not evaluate in time
Dustin Demuth <dustin@intevation.de>
parents:
794
diff
changeset
|
400 win.show(); |
1016
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
401 }, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
402 |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
403 showDetails: function(element) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
404 var search = element.up('fieldset').down('combobox[name=filter]'); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
405 var details = element.up('panel[name=main]').down('filterdetails'); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
406 |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
407 //Type of the search Proben/Messprogramme/Stammdaten |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
408 var record = search.store.getById(search.getValue()); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
409 details.setRecord(record); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
410 if (element.pressed) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
411 details.show(); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
412 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
413 else { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
414 details.hide(); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
415 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
416 }, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
417 |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
418 showManagement: function() { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
419 if (!this.managementWindow) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
420 this.managementWindow = Ext.create('Lada.view.window.FilterManagement'); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
421 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
422 this.managementWindow.show(); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
423 }, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
424 |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
425 triggerFilterUpdate: function(checkbox) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
426 var cbox = checkbox.up('fieldset').down('combobox[name=filter]'); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
427 this.updateFilter(cbox); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
428 }, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
429 |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
430 updateFilter: function(combobox) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
431 var store; |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
432 var entries; |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
433 var fav = combobox.up('fieldset').down('checkbox[name=favorites]'); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
434 if (this.mode === 'proben') { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
435 store = Ext.StoreManager.get('probequeries'); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
436 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
437 else if (this.mode === 'messprogramme') { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
438 store = Ext.StoreManager.get('messprogrammqueries'); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
439 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
440 else if (this.mode === 'stammdaten') { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
441 store = Ext.StoreManager.get('stammdatenqueries'); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
442 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
443 else { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
444 return; |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
445 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
446 if (fav.checked) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
447 entries = store.queryBy(function(record) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
448 if (record.get('favorite')) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
449 return true; |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
450 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
451 }); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
452 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
453 else { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
454 entries = store.queryBy(function() { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
455 return true; |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
456 }); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
457 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
458 combobox.store.removeAll(); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
459 combobox.store.add(entries.items); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
460 combobox.select(combobox.store.getAt(0)); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
461 combobox.fireEvent('select', combobox, [combobox.store.getAt(0)]); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
462 }, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
463 |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
464 saveFilterDefaults: function(button) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
465 var filters = button.up('fieldset').down('panel[name=filtervalues]'); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
466 |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
467 var search = button.up('fieldset').down('combobox[name=filter]'); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
468 |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
469 //Type of the search Proben/Messprogramme/Stammdaten |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
470 var qId = search.getValue(); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
471 var query = search.store.getById(qId); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
472 var ndx = 0; |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
473 for (var i = filters.items.length - 1; i >= 0; i--) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
474 var filter = filters.items.items[i]; |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
475 var filterId = filter.filterId; |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
476 var value = filter.getValue(); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
477 if (value instanceof Array) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
478 value = value.join(','); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
479 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
480 Ext.Ajax.request({ |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
481 url: 'lada-server/rest/filter', |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
482 method: 'PUT', |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
483 jsonData: { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
484 id: filterId, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
485 value: value |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
486 }, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
487 success: function() { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
488 ndx++; |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
489 for (var j = 0; j < query.data.filters.length; i++) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
490 if (query.data.filters[j].id === filterId) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
491 query.data.filters[j].value = value; |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
492 break; |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
493 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
494 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
495 if (ndx < filter.items.length - 1) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
496 return; |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
497 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
498 if (query.get('type') === 'probe') { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
499 Ext.StoreManager.get('probequeries').load(); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
500 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
501 else if (query.get('type') === 'messprogramm') { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
502 Ext.StoreManager.get('messprogrammqueries').load(); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
503 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
504 else { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
505 Ext.StoreManager.get('stammdatenqueries').load(); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
506 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
507 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
508 }); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
509 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
510 }, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
511 |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
512 resetFilterDefaults: function(button) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
513 var filters = button.up('fieldset').down('panel[name=filtervalues]'); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
514 |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
515 var search = button.up('fieldset').down('combobox[name=filter]'); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
516 |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
517 var qId = search.getValue(); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
518 var query = search.store.getById(qId); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
519 for (var i = filters.items.length - 1; i >= 0; i--) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
520 var filter = filters.items.items[i]; |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
521 var filterId = filter.filterId; |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
522 var value = filter.getValue(); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
523 if (value instanceof Array) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
524 value = value.join(','); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
525 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
526 Ext.Ajax.request({ |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
527 url: 'lada-server/rest/filter/' + filterId, |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
528 method: 'DELETE', |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
529 success: function(response) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
530 var json = Ext.decode(response.responseText); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
531 if (!json.success) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
532 return; |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
533 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
534 filter.setValue(json.data.value); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
535 for (var j = 0; j < query.data.filters.length; j++) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
536 if (query.data.filters[j].id === json.data.id) { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
537 query.data.filters[j].value = json.data.value; |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
538 break; |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
539 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
540 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
541 if (query.get('type') === 'probe') { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
542 Ext.StoreManager.get('probequeries').reload(); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
543 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
544 else if (query.get('type') === 'messprogramm') { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
545 Ext.StoreManager.get('messprogrammqueries').reload(); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
546 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
547 else { |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
548 Ext.StoreManager.get('stammdatenqueries').reload(); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
549 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
550 } |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
551 }); |
d6e259e76de6
Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1015
diff
changeset
|
552 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
553 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
554 }); |