Mercurial > lada > lada-client
annotate app/controller/Sql.js @ 369:cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Fri, 16 Aug 2013 12:20:51 +0200 |
parents | 71ca7e597952 |
children | 1179b3a1251b |
rev | line source |
---|---|
31
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
28
diff
changeset
|
1 var queries = new Array('query1', 'query2'); |
246
c5d7fae5997a
Change logic how to show and hide the search filters. Now we iterate over the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
241
diff
changeset
|
2 |
294
92b475303806
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
253
diff
changeset
|
3 /** |
92b475303806
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
253
diff
changeset
|
4 * Controller for the Search |
92b475303806
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
253
diff
changeset
|
5 * This controller handles all logic related to the search |
92b475303806
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
253
diff
changeset
|
6 */ |
6
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
7 Ext.define('Lada.controller.Sql', { |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
8 extend: 'Ext.app.Controller', |
8
e4fcb4ddd782
Moved stored SQL into its own file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
6
diff
changeset
|
9 stores: [ |
235
78134e20e62d
Added new model and store for Queries.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
147
diff
changeset
|
10 'Proben', // List of found Proben |
78134e20e62d
Added new model and store for Queries.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
147
diff
changeset
|
11 'Queries' |
8
e4fcb4ddd782
Moved stored SQL into its own file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
6
diff
changeset
|
12 ], |
369
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
13 requires: [ |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
14 'Lada.view.widgets.Mst', |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
15 'Lada.view.widgets.Uwb', |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
16 'Lada.view.widgets.Datetime' |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
17 ], |
6
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
18 init: function() { |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
19 console.log('Initialising the Sql controller'); |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
20 this.control({ |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
21 // CSS like selector to select element in the viewport. See |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
22 // ComponentQuery documentation for more details. |
31
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
28
diff
changeset
|
23 '#search': { |
6
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
24 // Map the "render" event to the given function. |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
25 render: this.onPanelRendered, |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
26 // Map Doubleclick on rows of the probenlist. |
28
4d60b9ebce15
Renamed sql modul into search. Further display The query selection as Combobox
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
25
diff
changeset
|
27 select: this.selectSql |
31
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
28
diff
changeset
|
28 }, |
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
28
diff
changeset
|
29 '#SearchBtn': { |
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
28
diff
changeset
|
30 // Map click event on Button. |
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
28
diff
changeset
|
31 click: this.search |
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
28
diff
changeset
|
32 }, |
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
28
diff
changeset
|
33 '#ResetBtn': { |
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
28
diff
changeset
|
34 // Map click event on Button. |
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
28
diff
changeset
|
35 click: this.reset |
6
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
36 } |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
37 }); |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
38 }, |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
39 onPanelRendered: function() { |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
40 console.log('The panel was rendered'); |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
41 }, |
294
92b475303806
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
253
diff
changeset
|
42 /** |
92b475303806
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
253
diff
changeset
|
43 * Function called when the user selects a SQL query in the dropdownlist. |
92b475303806
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
253
diff
changeset
|
44 * The function will hide/display additional element related to the |
92b475303806
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
253
diff
changeset
|
45 * selected search query |
92b475303806
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
253
diff
changeset
|
46 */ |
28
4d60b9ebce15
Renamed sql modul into search. Further display The query selection as Combobox
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
25
diff
changeset
|
47 selectSql: function(element, record, index) { |
241
4ca858026191
If the user selects a search query add call setupColumns method to dynamically
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
235
diff
changeset
|
48 var result = Ext.getCmp('result'); |
246
c5d7fae5997a
Change logic how to show and hide the search filters. Now we iterate over the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
241
diff
changeset
|
49 var filters = Ext.getCmp('queryfilters'); |
252
1bce2d59b7e9
Update description and sql statement when chosing another query
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
251
diff
changeset
|
50 var sqlquery = Ext.getCmp('sqlquery'); |
1bce2d59b7e9
Update description and sql statement when chosing another query
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
251
diff
changeset
|
51 var sqldesc = Ext.getCmp('sqldesc'); |
31
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
28
diff
changeset
|
52 var buttons = Ext.getCmp('SearchBtnPanel'); |
253
424f18da3c64
Fixed variable name
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
252
diff
changeset
|
53 var displayFields = record[0].data.results; |
246
c5d7fae5997a
Change logic how to show and hide the search filters. Now we iterate over the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
241
diff
changeset
|
54 var filterFields = record[0].data.filters; |
253
424f18da3c64
Fixed variable name
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
252
diff
changeset
|
55 |
31
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
28
diff
changeset
|
56 this.reset(); |
246
c5d7fae5997a
Change logic how to show and hide the search filters. Now we iterate over the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
241
diff
changeset
|
57 |
252
1bce2d59b7e9
Update description and sql statement when chosing another query
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
251
diff
changeset
|
58 sqlquery.setValue(record[0].data.sql); |
1bce2d59b7e9
Update description and sql statement when chosing another query
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
251
diff
changeset
|
59 sqldesc.setValue(record[0].data.description); |
1bce2d59b7e9
Update description and sql statement when chosing another query
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
251
diff
changeset
|
60 |
246
c5d7fae5997a
Change logic how to show and hide the search filters. Now we iterate over the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
241
diff
changeset
|
61 // Setup Columns of the probenlist |
241
4ca858026191
If the user selects a search query add call setupColumns method to dynamically
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
235
diff
changeset
|
62 result.setupColumns(displayFields); |
246
c5d7fae5997a
Change logic how to show and hide the search filters. Now we iterate over the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
241
diff
changeset
|
63 |
369
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
64 // Setup Filters of the probenlist |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
65 // |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
66 // Allowed types are |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
67 // * text |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
68 // * number |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
69 // * datetime |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
70 // * listmst |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
71 // * listumw |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
72 // |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
73 // Iterate over all configured filters and add filters dynamically |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
74 // |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
75 // 1. Empty filters |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
76 filters.removeAll(); |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
77 var hide = true; |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
78 // 2. Iterate over all configured filters |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
79 for (var j=0; j < filterFields.length; j++) { |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
80 var type = filterFields[j].type; |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
81 var name = filterFields[j].dataIndex; |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
82 var label = filterFields[j].label; |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
83 var field = null; |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
84 if (type == "text") { |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
85 console.log("Found text filter"); |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
86 field = Ext.create('Ext.form.field.Text', { name: name, fieldLabel: label }); |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
87 } else if (type == "number") { |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
88 console.log("Found number filter"); |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
89 field = Ext.create('Ext.form.field.Number', { name: name, fieldLabel: label }); |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
90 } else if (type == "datetime") { |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
91 console.log("Found datetime filter"); |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
92 field = Ext.create('Lada.view.widgets.Datetime', { name: name, fieldLabel: label }); |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
93 } else if (type == "listmst") { |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
94 console.log("Found listmst filter"); |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
95 field = Ext.create('Lada.view.widgets.Mst', { name: name, fieldLabel: label }); |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
96 } else if (type == "listumw") { |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
97 console.log("Found listumw filter"); |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
98 field = Ext.create('Lada.view.widgets.Uwb', { name: name, fieldLabel: label }); |
366 | 99 } |
369
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
100 if (field) { |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
101 console.log("Pushing field to filters"); |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
102 filters.add(field); |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
103 filters.show(); |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
104 hide = false; |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
105 } |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
106 } |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
107 if (hide) { |
246
c5d7fae5997a
Change logic how to show and hide the search filters. Now we iterate over the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
241
diff
changeset
|
108 filters.hide(); |
369
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
109 } |
31
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
28
diff
changeset
|
110 buttons.show(); |
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
28
diff
changeset
|
111 }, |
294
92b475303806
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
253
diff
changeset
|
112 /** |
92b475303806
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
253
diff
changeset
|
113 * Function is called when the user clicks the search button. The function |
92b475303806
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
253
diff
changeset
|
114 * will perform a search to the server on refreshes the result list. |
92b475303806
Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
253
diff
changeset
|
115 */ |
31
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
28
diff
changeset
|
116 search: function(element, record, index) { |
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
28
diff
changeset
|
117 var result = Ext.getCmp('result'); |
369
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
118 var filters = Ext.getCmp('queryfilters'); |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
119 var search = Ext.getCmp('search'); |
36
2a67e062519b
Implemted search. When user clicks on the search buttons parameters are
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
35
diff
changeset
|
120 |
2a67e062519b
Implemted search. When user clicks on the search buttons parameters are
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
35
diff
changeset
|
121 // Get search parameters: |
2a67e062519b
Implemted search. When user clicks on the search buttons parameters are
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
35
diff
changeset
|
122 var searchParams = {}; |
369
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
123 searchParams['qid'] = search.getValue(); |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
124 for (var i = filters.items.length - 1; i >= 0; i--){ |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
125 var filter = filters.items.items[i]; |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
126 var value = filter.getValue(); |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
127 if (value) { |
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
128 searchParams[filter.getName()] = filter.getValue(); |
96
ecb0c0cf386b
Only add search params if the user actually set them in the form.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
36
diff
changeset
|
129 } |
36
2a67e062519b
Implemted search. When user clicks on the search buttons parameters are
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
35
diff
changeset
|
130 } |
369
cebed9ef8293
Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
366
diff
changeset
|
131 console.log('Loading store with the following search params: ' + searchParams); |
36
2a67e062519b
Implemted search. When user clicks on the search buttons parameters are
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
35
diff
changeset
|
132 result.getStore().load({ |
2a67e062519b
Implemted search. When user clicks on the search buttons parameters are
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
35
diff
changeset
|
133 params: searchParams |
2a67e062519b
Implemted search. When user clicks on the search buttons parameters are
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
35
diff
changeset
|
134 }); |
28
4d60b9ebce15
Renamed sql modul into search. Further display The query selection as Combobox
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
25
diff
changeset
|
135 console.log('Store loaded'); |
25
f964a50bfe57
Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
17
diff
changeset
|
136 result.show(); |
31
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
28
diff
changeset
|
137 }, |
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
28
diff
changeset
|
138 reset: function(element, record, index) { |
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
28
diff
changeset
|
139 var buttons = Ext.getCmp('SearchBtnPanel'); |
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
28
diff
changeset
|
140 var result = Ext.getCmp('result'); |
246
c5d7fae5997a
Change logic how to show and hide the search filters. Now we iterate over the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
241
diff
changeset
|
141 //for (var i = 0; i < queries.length; ++i) { |
c5d7fae5997a
Change logic how to show and hide the search filters. Now we iterate over the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
241
diff
changeset
|
142 // var toHide = Ext.getCmp(queries[i]); |
c5d7fae5997a
Change logic how to show and hide the search filters. Now we iterate over the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
241
diff
changeset
|
143 // toHide.hide(); |
c5d7fae5997a
Change logic how to show and hide the search filters. Now we iterate over the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
241
diff
changeset
|
144 //} |
147
5da0b56bf9bf
Do no hide the earch buttons and the resultlist on reset.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
139
diff
changeset
|
145 //result.hide(); |
5da0b56bf9bf
Do no hide the earch buttons and the resultlist on reset.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
139
diff
changeset
|
146 //buttons.hide(); |
6
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
147 } |
8e79bda4d55b
Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
148 }); |