annotate app/view/FilterPanel.js @ 1229:eeed1b92341f

Avoid side effect of setting 0 as default value. Temporarily, this was not a problem, as 0 was a valid baId, but since server Rev d1d7d684800c this is not the case anymore.
author Tom Gottfried <tom@intevation.de>
date Fri, 28 Oct 2016 17:02:42 +0200
parents 414f7c9908d6
children 3b4dcc83a21b
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
870
2e81d2ad6af7 added a * in coomments. jsduck can find this class now
Dustin Demuth <dustin@intevation.de>
parents: 795
diff changeset
9 /**
747
3ffecbce17d6 Radio-Buttons to switch between query-modes: Probenliste und Probenplanung. Filter-Combobox store wird automatisch gewechselt. ToDo: Query-Store für Probenplanung
Dustin Demuth <dustin@intevation.de>
parents: 609
diff changeset
10 * Panel to show available search queries
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 */
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.FilterPanel', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Ext.form.FieldSet',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 alias: 'widget.filterpanel',
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 require: [
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 'Ext.layout.container.Column'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 ],
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19
1015
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
20 title: 'Filter',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 initComponent: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 this.layout = {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 type: 'vbox',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 align: 'stretch'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 };
795
255568e97c96 Latest commit broke the search function
Dustin Demuth <dustin@intevation.de>
parents: 794
diff changeset
26 var me = this;
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 this.items = [{
1015
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
28 layout: 'hbox',
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
29 border: false,
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
30 items: [{
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
31 xtype: 'combobox',
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
32 name: 'filter',
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
33 editable: false,
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
34 flex: 1,
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
35 displayField: 'name',
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
36 valueField: 'id',
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
37 queryMode: 'local',
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
38 emptyText: 'Wählen Sie eine Abfrage'
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
39 }, {
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
40 xtype: 'button',
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
41 action: 'details',
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
42 enableToggle: true,
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
43 text: 'Details',
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
44 margin: '0 0 0 10'
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
45 }]
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
46 }, {
1104
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
47 layout: {
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
48 type: 'hbox',
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
49 },
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
50 border: false,
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
51 items: [{
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
52 xtype: 'checkbox',
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
53 name: 'favorites',
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
54 boxLabel: 'nur Favoriten',
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
55 checked: true
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
56 }, {
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
57 xtype: 'button',
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
58 action: 'manage',
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
59 text: 'Filterauswahl bearbeiten',
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
60 margin: '0 0 0 20'
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
61 }]
1015
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
62 }, {
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
63 xtype: 'displayfield',
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
64 name: 'description',
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
65 shrinkWrap: 3,
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
66 margin: '0, 0, 0 ,5',
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
67 value: '-/-'
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 xtype: 'panel',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 border: false,
1104
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
71 margin: '10 0 10 0',
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
72 items: [{
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
73 xtype: 'button',
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
74 action: 'search',
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
75 text: 'Suchen',
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
76 margin: '0 10 0 0'
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
77 }, {
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
78 xtype: 'button',
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
79 action: 'reset',
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
80 text: 'Zurücksetzen',
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
81 margin: '0 10 0 0'
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
82 }],
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
83 hidden: false
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
84 }, {
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
85 xtype: 'panel',
414f7c9908d6 some reorg of filterpanal and messprogramm form
Michael Stanko <mstanko@bfs.de>
parents: 1064
diff changeset
86 border: false,
1016
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
87 name: 'filtervariables',
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
88 hidden: true,
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
89 margin: '10, 0, 10, 0',
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
90 items: [{
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
91 xtype: 'panel',
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
92 border: false,
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
93 name: 'filtervalues',
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
94 items: []
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
95 }, {
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
96 layout: {
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
97 type: 'hbox',
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
98 pack: 'end'
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
99 },
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
100 border: false,
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
101 items: [{
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
102 xtype: 'button',
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
103 action: 'savedefault',
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
104 text: 'Vorbelegung speichern',
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
105 margin: '0, 10, 0, 0'
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
106 }, {
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
107 xtype: 'button',
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
108 action: 'resetdefault',
1064
cc17de34c689 Renamed button.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1029
diff changeset
109 text: 'Vorbelegung zurücksetzen'
1016
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
110 }]
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1015
diff changeset
111 }]
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
112 }];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113 this.callParent(arguments);
1015
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
114 var combo = me.down('combobox[name=filter]');
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
115 combo.store = Ext.create('Ext.data.Store', {
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
116 model: 'Lada.model.Query'
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
117 });
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
118 var store = Ext.StoreManager.get('probequeries');
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
119 store.on('load', function storeLoad () {
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
120 var entries = store.queryBy(function(record) {
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
121 if (record.get('favorite')) {
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
122 return true;
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
123 }
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
124 });
1029
e3ca9f7d8a4f Avoid an empty filter combobox on startup.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1016
diff changeset
125 if (entries.getCount() === 0) {
e3ca9f7d8a4f Avoid an empty filter combobox on startup.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1016
diff changeset
126 var cb = me.down('checkbox[name=favorites]');
e3ca9f7d8a4f Avoid an empty filter combobox on startup.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1016
diff changeset
127 cb.setValue(false);
e3ca9f7d8a4f Avoid an empty filter combobox on startup.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1016
diff changeset
128 }
1015
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
129 combo.store.add(entries.items);
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
130 combo.select(combo.store.getAt(0));
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
131 combo.fireEvent('select', combo, [combo.store.getAt(0)]);
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
132 store.un('load', storeLoad);
af9879d72310 Updated UI, added window for filter management and added fieldset for query
Raimund Renkert <raimund.renkert@intevation.de>
parents: 870
diff changeset
133 });
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
134 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
135 });

http://lada.wald.intevation.org