annotate app/controller/Filter.js @ 976:3c770fc7cf19 stammdatengrids

Added a variable which makes it possible to detect if a grid is dynamic
author Dustin Demuth <dustin@intevation.de>
date Wed, 02 Dec 2015 17:53:20 +0100
parents fb99332bb48e
children c6ae0aadb634
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
f1e964b3aad6 Trailing Commas
Dustin Demuth <dustin@intevation.de>
parents: 874
diff changeset
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
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]');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 var columns = element.up('fieldset').down('displayfield[name=columns]');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 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
69 this.displayFields = record[0].data.results;
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 var filterFields = record[0].data.filters;
975
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
71 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
72 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
73 // or a stammdatendtype
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74
734
2d482dfaa41a Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 657
diff changeset
75 this.reset(element);
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76
975
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
77 contentPanel.removeAll();
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
78
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
79 /// THIS IS INTERMEDIARY CODE AND CAN BE REMOVED WHEN TYPES ARE SENT FOR PROBEN AND MESSPROGRAMME
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
80 console.log('remove this intermediary code...');
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
81 var modes = element.up('panel[name=main]').down('radiogroup').getChecked();
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
82 queryType = (queryType) ? queryType : modes[0].inputValue;
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
83 /// END OF INTERMEDIARY CODE
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
84
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
85
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
86 if (queryType == 'proben' || queryType == 'messprogramme') {
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
87 var frgrid; // The Resultgrid
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
88 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
89
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
90 switch (queryType) {
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
91 case 'proben':
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
92 gridstore = Ext.create('Lada.store.ProbenList');
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
93 frgrid = Ext.create('Lada.view.grid.ProbeList');
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
94 break;
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
95 case 'messprogramme':
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
96 gridstore = Ext.create('Lada.store.MessprogrammeList');
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
97 frgrid = Ext.create('Lada.view.grid.MessprogrammeList');
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
98 break;
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
99 }
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 var columnString = [];
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
102 for (var i = 0; i < this.displayFields.length; i++) {
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
103 columnString.push(this.displayFields[i].header);
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
104 }
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
105 columns.setValue(columnString.join(', '));
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
106 desc.setValue(record[0].data.description);
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
107
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
108 // Setup Columns
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
109 if (this.displayFields) {
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
110 this.displayFields.reverse();
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
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
113 if (gridstore) {
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
114 frgrid.setStore(gridstore);
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
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
117 contentPanel.add(frgrid);
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
118 }
975
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
119 else {
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
120 // Grids which are not build with dynamic columns
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
121 var resultGrid;
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
122 switch (queryType) {
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
123 case 'MessprogrammKategorie':
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
124 resultGrid = Ext.create('Lada.view.grid.MessprogrammKategorie');
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
125 break;
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
126 case 'DatensatzErzeuger':
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
127 resultGrid = Ext.create('Lada.view.grid.DatensatzErzeuger');
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
128 break;
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
129 }
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
130 if (resultGrid) {
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
131 contentPanel.add(resultGrid);
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
132 }
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
133 }
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
134 /* Setup Filters
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
135 *
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
136 * Allowed types are
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
137 * * text
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
138 * * number
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
139 * * datetime
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
140 * * bool
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
141 * * listmst
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
142 * * listumw
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
143 * * listver
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
144 * * listdbasis
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
145 * * listnetz
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
146 *
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
147 * 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
148 *
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
149 * 1. Empty filters
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
150 */
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151 filters.removeAll();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
152 var hide = true;
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
153 /* 2. Iterate over all configured filters */
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
154 var j;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
155 for (j = 0; j < filterFields.length; j++) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
156 var type = filterFields[j].type;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
157 var name = filterFields[j].dataIndex;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
158 var label = filterFields[j].label;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
159 var multi = filterFields[j].multiSelect;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
160 var field = null;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
161 if (type === 'text') {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
162 field = Ext.create('Ext.form.field.Text', {
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 fieldLabel: label
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
165 });
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
166 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
167 else if (type === 'number') {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
168 field = Ext.create('Ext.form.field.Number', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
169 name: name,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
170 labelWidth: 135,
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 === 'datetime') {
575
54dbb6c44ca6 Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
175 field = Ext.create('Lada.view.widget.Datetime', {
548
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 === 'bool') {
575
54dbb6c44ca6 Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
182 field = Ext.create('Lada.view.widget.Testdatensatz', {
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 emptyText: ''
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 else if (type === 'listmst') {
575
54dbb6c44ca6 Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
190 field = Ext.create('Lada.view.widget.Messstelle', {
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
191 name: name,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
192 labelWidth: 135,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
193 fieldLabel: label,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
194 multiSelect: multi
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 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
197 else if (type === 'listumw') {
575
54dbb6c44ca6 Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
198 field = Ext.create('Lada.view.widget.Umwelt', {
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
199 name: name,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
200 labelWidth: 135,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
201 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
202 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
203 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
204 '<tpl for=".">{id} </tpl>')
548
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 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
207 else if (type === 'listdbasis') {
575
54dbb6c44ca6 Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
208 field = Ext.create('Lada.view.widget.Datenbasis', {
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
209 name: name,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
210 labelWidth: 135,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
211 fieldLabel: label,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
212 multiSelect: multi
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 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
215 else if (type === 'listver') {
575
54dbb6c44ca6 Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
216 field = Ext.create('Lada.view.widget.Verwaltungseinheit', {
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
217 name: name,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
218 labelWidth: 135,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
219 fieldLabel: label,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
220 multiSelect: multi
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 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
223 else if (type === 'listnetz') {
575
54dbb6c44ca6 Fixed filter widget creation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
224 field = Ext.create('Lada.view.widget.Netzbetreiber', {
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
225 name: name,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
226 labelWidth: 135,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
227 fieldLabel: label,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
228 multiSelect: multi
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 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
231 if (field) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
232 filters.add(field);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
233 filters.show();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
234 hide = false;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
235 }
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 if (hide) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
238 filters.hide();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
239 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
240 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
241
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 * 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
244 * 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
245 * 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
246 */
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
247 search: function(element) {
975
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
248 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
249 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
250 var search = element.up('fieldset').down('combobox[name=filter]');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
251
975
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
252 //Type of the search Proben/Messprogramme/Stammdaten
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
253 var type = search.store.getById(search.getValue()).get('type')
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
254
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
255 // Get search parameters:
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
256 var searchParams = {};
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
257 searchParams['qid'] = search.getValue();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
258 for (var i = filters.items.length - 1; i >= 0; i--) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
259 var filter = filters.items.items[i];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
260 var value = filter.getValue();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
261 if (value instanceof Array) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
262 value = value.join(',');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
263 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
264 searchParams[filter.getName()] = value;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
265 }
751
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 742
diff changeset
266 // Retrieve the mode
752
639e82e2089e remove and hide filters when switching between modes
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
267 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
268 var sname = modes[0].inputValue;
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 742
diff changeset
269
975
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
270 // Todo: Migragte away from sname, use type instead
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
271 if (sname === 'proben') {
751
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 742
diff changeset
272 sname = 'Lada.store.ProbenList';
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 742
diff changeset
273 }
975
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
274 else if (sname === 'messprogramme') {
751
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 742
diff changeset
275 sname = 'Lada.store.MessprogrammeList';
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 742
diff changeset
276 }
975
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
277 else if (sname === 'stammdaten') {
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
278 //Store depends of the Type...
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
279 // TODO the switchcasese should be unified
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
280 switch (type) {
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
281 case 'MessprogrammKategorie':
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
282 sname = 'Lada.store.MessprogrammKategorie';
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
283 break;
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
284 case 'DatensatzErzeuger':
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
285 sname = 'Lada.store.DatensatzErzeuger';
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
286 break;
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
287 }
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents: 908
diff changeset
288 }
751
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 742
diff changeset
289
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 742
diff changeset
290 // 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
291 var store = Ext.StoreManager.lookup(sname);
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 742
diff changeset
292 if (!store) {
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 742
diff changeset
293 store = Ext.create(sname);
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 742
diff changeset
294 }
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 742
diff changeset
295 if (store) {
810
a5373ee662e2 Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents: 800
diff changeset
296 store.addListener('beforeload', this.loadingAnimationOn, resultGrid);
a5373ee662e2 Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents: 800
diff changeset
297 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
298
751
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 742
diff changeset
299 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
300 //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
301 // 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
302
3c770fc7cf19 Added a variable which makes it possible to detect if a grid is dynamic
Dustin Demuth <dustin@intevation.de>
parents: 975
diff changeset
303 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
304 //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
305 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
306 }
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
751
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 742
diff changeset
308 resultGrid.getStore().proxy.extraParams = searchParams;
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 742
diff changeset
309 resultGrid.getStore().load();
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 742
diff changeset
310 resultGrid.show();
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 742
diff changeset
311 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
312 },
810
a5373ee662e2 Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents: 800
diff changeset
313
a5373ee662e2 Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents: 800
diff changeset
314 /**
a5373ee662e2 Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents: 800
diff changeset
315 * Enable the Loading Animation of the Grid.
a5373ee662e2 Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents: 800
diff changeset
316 */
a5373ee662e2 Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents: 800
diff changeset
317 loadingAnimationOn: function(store, operation) {
a5373ee662e2 Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents: 800
diff changeset
318 // 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
319 this.setLoading(true);
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 /**
a5373ee662e2 Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents: 800
diff changeset
323 * Disable the Loading Animation of the Grid.
a5373ee662e2 Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents: 800
diff changeset
324 */
a5373ee662e2 Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents: 800
diff changeset
325 loadingAnimationOff: function(store, operation) {
a5373ee662e2 Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents: 800
diff changeset
326 // 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
327 this.setLoading(false);
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
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
330 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
331 * This function resets the filters
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
332 */
734
2d482dfaa41a Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 657
diff changeset
333 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
334 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
335 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
336 var filter = filters.items.items[i];
844
1449d58d6f58 Clear the text filter correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 810
diff changeset
337 if (filter.clearValue) {
1449d58d6f58 Clear the text filter correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 810
diff changeset
338 filter.clearValue();
1449d58d6f58 Clear the text filter correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 810
diff changeset
339 }
1449d58d6f58 Clear the text filter correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 810
diff changeset
340 else {
1449d58d6f58 Clear the text filter correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 810
diff changeset
341 filter.setValue('');
1449d58d6f58 Clear the text filter correctly.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 810
diff changeset
342 }
734
2d482dfaa41a Update list on search and reset filter values on reset button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 657
diff changeset
343 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
344 },
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
345 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
346 * 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
347 * It has no function yet.
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 734
diff changeset
348 */
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
349 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
350 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
351 win.show();
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
352 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
353 });

http://lada.wald.intevation.org