Mercurial > lada > lada-client
annotate app/controller/Filter.js @ 1008:9651def05ae6
merged.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 20 Jan 2016 17:45:58 +0100 |
parents | 23bfcbdb4527 9ac03f461ab4 |
children | af9879d72310 |
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', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 'Lada.view.widget.Umwelt' |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 ], |
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 stores: [ |
908
96e04c258b8f
Fixed Code to correct minified js
Dustin Demuth <dustin@intevation.de>
parents:
882
diff
changeset
|
22 'ProbenList', // List of found Proben |
96e04c258b8f
Fixed Code to correct minified js
Dustin Demuth <dustin@intevation.de>
parents:
882
diff
changeset
|
23 'MessprogrammeList' //List of found Messprogramme |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 ], |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 |
734
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
26 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
|
27 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
28 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
29 * Initialize this Controller |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
30 * It has 4 Listeners |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
31 */ |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 init: function() { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 this.control({ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 // CSS like selector to select element in the viewport. See |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 // 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
|
36 '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
|
37 // Map Select event |
882 | 38 select: this.selectSql |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 }, |
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
|
40 'filterpanel button[action=search]': { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 // Map click event on Button. |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 click: this.search |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 }, |
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
|
44 'filterpanel button[action=reset]': { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 // Map click event on Button. |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 click: this.reset |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 'menuitem[action=about]': { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 // Map click event on Button. |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 click: this.about |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 this.callParent(arguments); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 /** |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 * 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
|
58 * 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
|
59 * selected search query. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
60 * It also replaces the Store of the Filteresultgrid. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
61 * 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
|
62 * 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
|
63 * vary between orte, kategorien, ... |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 */ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 selectSql: function(element, record) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 var filters = element.up('panel[name=main]').down('fieldset[name=filtervariables]'); |
979 | 67 |
68 // Set "Filter Auswahl" Description | |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 var desc = element.up('fieldset').down('displayfield[name=description]'); |
979 | 70 desc.setValue(record[0].data.description); |
71 | |
734
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
72 this.displayFields = record[0].data.results; |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 var filterFields = record[0].data.filters; |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
74 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
|
75 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
|
76 // or a stammdatendtype |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 |
734
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
78 this.reset(element); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 |
979 | 80 contentPanel.removeAll(); //clear the panel: make space for new grids |
81 | |
82 // Set "Filter Auswahl" Columns | |
83 var columns = element.up('fieldset').down('displayfield[name=columns]'); | |
84 var columnString = []; | |
85 for (var i = 0; i < this.displayFields.length; i++) { | |
86 columnString.push(this.displayFields[i].header); | |
87 } | |
88 columns.setValue(columnString.join(', ')); | |
89 | |
90 // Setup Columns | |
91 if (this.displayFields) { | |
92 this.displayFields.reverse(); | |
93 } | |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
94 |
981
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
95 if (queryType == 'probe' || queryType == 'messprogramm') { |
979 | 96 // Dynamic Grids |
97 // We need to set both grid and Store. | |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
98 var frgrid; // The Resultgrid |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
99 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
|
100 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
101 switch (queryType) { |
981
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
102 case 'probe': |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
103 gridstore = Ext.create('Lada.store.ProbenList'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
104 frgrid = Ext.create('Lada.view.grid.ProbeList'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
105 break; |
981
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
106 case 'messprogramm': |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
107 gridstore = Ext.create('Lada.store.MessprogrammeList'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
108 frgrid = Ext.create('Lada.view.grid.MessprogrammeList'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
109 break; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
110 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
111 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
112 if (gridstore) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
113 frgrid.setStore(gridstore); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
114 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
115 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
116 contentPanel.add(frgrid); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
117 } |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
118 else { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
119 // Grids which are not build with dynamic columns |
979 | 120 // The store is configured in each grid, hence we only need to set the |
121 // grid | |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
122 var resultGrid; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
123 switch (queryType) { |
981
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
124 case 'messprogrammkategorie': |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
125 resultGrid = Ext.create('Lada.view.grid.MessprogrammKategorie'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
126 break; |
981
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
127 case 'datensatzerzeuger': |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
128 resultGrid = Ext.create('Lada.view.grid.DatensatzErzeuger'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
129 break; |
981
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
130 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
|
131 resultGrid = Ext.create('Lada.view.grid.Orte'); |
981
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
132 break; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
133 case 'probenehmer': |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
134 resultGrid = Ext.create('Lada.view.grid.Probenehmer'); |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
135 break; |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
136 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
137 if (resultGrid) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
138 contentPanel.add(resultGrid); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
139 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
140 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
141 /* Setup Filters |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
142 * |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
143 * Allowed types are |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
144 * * text |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
145 * * number |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
146 * * datetime |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
147 * * bool |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
148 * * listmst |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
149 * * listumw |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
150 * * listver |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
151 * * listdbasis |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
152 * * listnetz |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
153 * |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
154 * 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
|
155 * |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
156 * 1. Empty filters |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
157 */ |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
158 filters.removeAll(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
159 var hide = true; |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
160 /* 2. Iterate over all configured filters */ |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
161 var j; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
162 for (j = 0; j < filterFields.length; j++) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
163 var type = filterFields[j].type; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
164 var name = filterFields[j].dataIndex; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
165 var label = filterFields[j].label; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
166 var multi = filterFields[j].multiSelect; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
167 var field = null; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
168 if (type === 'text') { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
169 field = Ext.create('Ext.form.field.Text', { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
170 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
171 fieldLabel: label |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
172 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
173 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
174 else if (type === 'number') { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
175 field = Ext.create('Ext.form.field.Number', { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
176 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
177 labelWidth: 135, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
178 fieldLabel: label |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
179 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
180 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
181 else if (type === 'datetime') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
182 field = Ext.create('Lada.view.widget.Datetime', { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
183 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
184 labelWidth: 135, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
185 fieldLabel: label |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
186 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
187 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
188 else if (type === 'bool') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
189 field = Ext.create('Lada.view.widget.Testdatensatz', { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
190 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
191 labelWidth: 135, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
192 fieldLabel: label, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
193 emptyText: '' |
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 === 'listmst') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
197 field = Ext.create('Lada.view.widget.Messstelle', { |
548
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, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
200 fieldLabel: label, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
201 multiSelect: multi |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
202 }); |
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 else if (type === 'listumw') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
205 field = Ext.create('Lada.view.widget.Umwelt', { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
206 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
207 labelWidth: 135, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
208 fieldLabel: label, |
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
|
209 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
|
210 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
|
211 '<tpl for=".">{id} </tpl>') |
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 === 'listdbasis') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
215 field = Ext.create('Lada.view.widget.Datenbasis', { |
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, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
219 multiSelect: multi |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
220 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
221 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
222 else if (type === 'listver') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
223 field = Ext.create('Lada.view.widget.Verwaltungseinheit', { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
224 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
225 labelWidth: 135, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
226 fieldLabel: label, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
227 multiSelect: multi |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
228 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
229 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
230 else if (type === 'listnetz') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
231 field = Ext.create('Lada.view.widget.Netzbetreiber', { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
232 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
233 labelWidth: 135, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
234 fieldLabel: label, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
235 multiSelect: multi |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
236 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
237 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
238 if (field) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
239 filters.add(field); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
240 filters.show(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
241 hide = false; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
242 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
243 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
244 if (hide) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
245 filters.hide(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
246 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
247 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
248 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
249 /** |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
250 * 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
|
251 * 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
|
252 * 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
|
253 */ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
254 search: function(element) { |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
255 var resultGrid = element.up('panel[name=main]').down('panel[name=contentpanel]').down('grid'); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
256 var filters = element.up('panel[name=main]').down('fieldset[name=filtervariables]'); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
257 var search = element.up('fieldset').down('combobox[name=filter]'); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
258 |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
259 //Type of the search Proben/Messprogramme/Stammdaten |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
260 var type = search.store.getById(search.getValue()).get('type') |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
261 |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
262 // Get search parameters: |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
263 var searchParams = {}; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
264 searchParams['qid'] = search.getValue(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
265 for (var i = filters.items.length - 1; i >= 0; i--) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
266 var filter = filters.items.items[i]; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
267 var value = filter.getValue(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
268 if (value instanceof Array) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
269 value = value.join(','); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
270 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
271 searchParams[filter.getName()] = value; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
272 } |
751
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
273 |
981
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
274 //Store depends of the Type... |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
275 // 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
|
276 switch (type) { |
983 | 277 case 'probe': |
981
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
278 sname = 'Lada.store.ProbenList'; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
279 break; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
280 case 'messprogramm': |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
281 sname = 'Lada.store.MessprogrammeList'; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
282 break; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
283 case 'messprogrammkategorie': |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
284 sname = 'Lada.store.MessprogrammKategorie'; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
285 break; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
286 case 'datensatzerzeuger': |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
287 sname = 'Lada.store.DatensatzErzeuger'; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
288 break; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
289 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
|
290 sname = 'Lada.store.Orte'; |
981
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
291 break; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
292 case 'probenehmer': |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
293 sname = 'Lada.store.Probenehmer'; |
2c394e72ba41
Use the lada-server for stammdatenqueries.
Dustin Demuth <dustin@intevation.de>
parents:
979
diff
changeset
|
294 break; |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
908
diff
changeset
|
295 } |
751
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
296 |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
297 // 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
|
298 var store = Ext.StoreManager.lookup(sname); |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
299 if (!store) { |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
300 store = Ext.create(sname); |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
301 } |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
302 if (store) { |
810
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
303 store.addListener('beforeload', this.loadingAnimationOn, resultGrid); |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
304 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
|
305 |
751
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
306 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
|
307 //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
|
308 // 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
|
309 |
3c770fc7cf19
Added a variable which makes it possible to detect if a grid is dynamic
Dustin Demuth <dustin@intevation.de>
parents:
975
diff
changeset
|
310 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
|
311 //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
|
312 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
|
313 } |
3c770fc7cf19
Added a variable which makes it possible to detect if a grid is dynamic
Dustin Demuth <dustin@intevation.de>
parents:
975
diff
changeset
|
314 |
751
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
315 resultGrid.getStore().proxy.extraParams = searchParams; |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
316 resultGrid.getStore().load(); |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
317 resultGrid.show(); |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
318 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
319 }, |
810
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
320 |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
321 /** |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
322 * Enable the Loading Animation of the Grid. |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
323 */ |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
324 loadingAnimationOn: function(store, operation) { |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
325 // 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
|
326 this.setLoading(true); |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
327 }, |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
328 |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
329 /** |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
330 * Disable the Loading Animation of the Grid. |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
331 */ |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
332 loadingAnimationOff: function(store, operation) { |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
333 // 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
|
334 this.setLoading(false); |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
335 }, |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
336 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
337 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
338 * This function resets the filters |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
339 */ |
734
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
340 reset: function(element) { |
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
341 var filters = element.up('panel[name=main]').down('fieldset[name=filtervariables]'); |
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
342 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
|
343 var filter = filters.items.items[i]; |
844
1449d58d6f58
Clear the text filter correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
810
diff
changeset
|
344 if (filter.clearValue) { |
1449d58d6f58
Clear the text filter correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
810
diff
changeset
|
345 filter.clearValue(); |
1449d58d6f58
Clear the text filter correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
810
diff
changeset
|
346 } |
1449d58d6f58
Clear the text filter correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
810
diff
changeset
|
347 else { |
1449d58d6f58
Clear the text filter correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
810
diff
changeset
|
348 filter.setValue(''); |
1449d58d6f58
Clear the text filter correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
810
diff
changeset
|
349 } |
734
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
350 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
351 }, |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
352 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
353 * 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
|
354 * It has no function yet. |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
355 */ |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
356 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
|
357 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
|
358 win.show(); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
359 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
360 }); |