Mercurial > lada > lada-client
annotate app/controller/Filter.js @ 910:a587d313c516
Added tag 2.1.0 for changeset 0b6e965d3d9e
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Thu, 06 Aug 2015 15:33:55 +0200 |
parents | 96e04c258b8f |
children | fb99332bb48e 092e245b13a4 |
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. |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 '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 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 'button[action=search]': { |
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 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 'button[action=reset]': { |
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 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 * selected search query |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 */ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 selectSql: function(element, record) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 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
|
63 var columns = element.up('fieldset').down('displayfield[name=columns]'); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 var desc = element.up('fieldset').down('displayfield[name=description]'); |
734
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
65 this.displayFields = record[0].data.results; |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 var filterFields = record[0].data.filters; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 |
734
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
68 this.reset(element); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 var columnString = []; |
734
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
71 for (var i = 0; i < this.displayFields.length; i++) { |
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
72 columnString.push(this.displayFields[i].header); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 columns.setValue(columnString.join(', ')); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 desc.setValue(record[0].data.description); |
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 // Setup Columns of the probenlist |
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.displayFields.reverse(); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
80 /* Setup Filters of the probenlist |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
81 * |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
82 * Allowed types are |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
83 * * text |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
84 * * number |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
85 * * datetime |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
86 * * bool |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
87 * * listmst |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
88 * * listumw |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
89 * * listver |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
90 * * listdbasis |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
91 * * listnetz |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
92 * |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
93 * 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
|
94 * |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
95 * 1. Empty filters |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
96 */ |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 filters.removeAll(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 var hide = true; |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
99 /* 2. Iterate over all configured filters */ |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
100 var j; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
101 for (j = 0; j < filterFields.length; j++) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
102 var type = filterFields[j].type; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 var name = filterFields[j].dataIndex; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
104 var label = filterFields[j].label; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
105 var multi = filterFields[j].multiSelect; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
106 var field = null; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
107 if (type === 'text') { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
108 field = Ext.create('Ext.form.field.Text', { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
109 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
110 fieldLabel: label |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
111 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
112 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
113 else if (type === 'number') { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
114 field = Ext.create('Ext.form.field.Number', { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
115 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
116 labelWidth: 135, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
117 fieldLabel: label |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
118 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
119 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
120 else if (type === 'datetime') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
121 field = Ext.create('Lada.view.widget.Datetime', { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
122 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
123 labelWidth: 135, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
124 fieldLabel: label |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
125 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
126 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
127 else if (type === 'bool') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
128 field = Ext.create('Lada.view.widget.Testdatensatz', { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
129 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
130 labelWidth: 135, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
131 fieldLabel: label, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
132 emptyText: '' |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
133 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
134 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
135 else if (type === 'listmst') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
136 field = Ext.create('Lada.view.widget.Messstelle', { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
137 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
138 labelWidth: 135, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
139 fieldLabel: label, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
140 multiSelect: multi |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
141 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
142 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
143 else if (type === 'listumw') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
144 field = Ext.create('Lada.view.widget.Umwelt', { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
145 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
146 labelWidth: 135, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
147 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
|
148 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
|
149 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
|
150 '<tpl for=".">{id} </tpl>') |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
151 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
152 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
153 else if (type === 'listdbasis') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
154 field = Ext.create('Lada.view.widget.Datenbasis', { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
155 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
156 labelWidth: 135, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
157 fieldLabel: label, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
158 multiSelect: multi |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
159 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
160 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
161 else if (type === 'listver') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
162 field = Ext.create('Lada.view.widget.Verwaltungseinheit', { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
163 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
164 labelWidth: 135, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
165 fieldLabel: label, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
166 multiSelect: multi |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
167 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
168 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
169 else if (type === 'listnetz') { |
575
54dbb6c44ca6
Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
170 field = Ext.create('Lada.view.widget.Netzbetreiber', { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
171 name: name, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
172 labelWidth: 135, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
173 fieldLabel: label, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
174 multiSelect: multi |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
175 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
176 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
177 if (field) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
178 filters.add(field); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
179 filters.show(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
180 hide = false; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
181 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
182 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
183 if (hide) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
184 filters.hide(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
185 } |
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 /** |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
189 * 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
|
190 * will perform a search to the server on refreshes the result list. |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
191 */ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
192 search: function(element) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
193 var resultGrid = element.up('panel[name=main]').down('filterresultgrid'); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
194 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
|
195 var search = element.up('fieldset').down('combobox[name=filter]'); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
196 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
197 // Get search parameters: |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
198 var searchParams = {}; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
199 searchParams['qid'] = search.getValue(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
200 for (var i = filters.items.length - 1; i >= 0; i--) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
201 var filter = filters.items.items[i]; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
202 var value = filter.getValue(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
203 if (value instanceof Array) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
204 value = value.join(','); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
205 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
206 searchParams[filter.getName()] = value; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
207 } |
751
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
208 // Retrieve the mode |
752
639e82e2089e
remove and hide filters when switching between modes
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
209 var modes = element.up('panel[name=main]').down('radiogroup').getChecked(); |
751
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
210 var sname = modes[0].inputValue; |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
211 |
792
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
752
diff
changeset
|
212 if (sname === 'ProbeList') { |
751
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
213 sname = 'Lada.store.ProbenList'; |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
214 } |
792
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
752
diff
changeset
|
215 else if (sname === 'MessprogrammList') { |
751
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
216 sname = 'Lada.store.MessprogrammeList'; |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
217 } |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
218 |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
219 // 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
|
220 var store = Ext.StoreManager.lookup(sname); |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
221 if (!store) { |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
222 store = Ext.create(sname); |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
223 } |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
224 if (store) { |
810
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
225 store.addListener('beforeload', this.loadingAnimationOn, resultGrid); |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
226 store.addListener('load', this.loadingAnimationOff, resultGrid); |
751
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
227 resultGrid.setStore(store); |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
228 resultGrid.setupColumns(this.displayFields); |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
229 resultGrid.getStore().proxy.extraParams = searchParams; |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
230 resultGrid.getStore().load(); |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
231 resultGrid.show(); |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
232 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
233 }, |
810
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
234 |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
235 /** |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
236 * Enable the Loading Animation of the Grid. |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
237 */ |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
238 loadingAnimationOn: function(store, operation) { |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
239 // 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
|
240 this.setLoading(true); |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
241 }, |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
242 |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
243 /** |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
244 * Disable the Loading Animation of the Grid. |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
245 */ |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
246 loadingAnimationOff: function(store, operation) { |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
247 // 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
|
248 this.setLoading(false); |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
249 }, |
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
800
diff
changeset
|
250 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
251 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
252 * This function resets the filters |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
253 */ |
734
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
254 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
|
255 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
|
256 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
|
257 var filter = filters.items.items[i]; |
844
1449d58d6f58
Clear the text filter correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
810
diff
changeset
|
258 if (filter.clearValue) { |
1449d58d6f58
Clear the text filter correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
810
diff
changeset
|
259 filter.clearValue(); |
1449d58d6f58
Clear the text filter correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
810
diff
changeset
|
260 } |
1449d58d6f58
Clear the text filter correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
810
diff
changeset
|
261 else { |
1449d58d6f58
Clear the text filter correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
810
diff
changeset
|
262 filter.setValue(''); |
1449d58d6f58
Clear the text filter correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
810
diff
changeset
|
263 } |
734
2d482dfaa41a
Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
657
diff
changeset
|
264 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
265 }, |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
266 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
267 * 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
|
268 * It has no function yet. |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
734
diff
changeset
|
269 */ |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
270 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
|
271 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
|
272 win.show(); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
273 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
274 }); |