annotate app/controller/Filter.js @ 979:c6ae0aadb634 stammdatengrids

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

http://lada.wald.intevation.org