[Lada-commits] [PATCH 03 of 11] Change logic how to show and hide the search filters. Now we iterate over the
Wald Commits
scm-commit at wald.intevation.org
Wed Jul 24 15:27:59 CEST 2013
# HG changeset patch
# User Torsten Irländer <torsten.irlaender at intevation.de>
# Date 1374581891 -7200
# Node ID c5d7fae5997aabdba724dddb4cb826b8c9c4dcc3
# Parent 9a2c04b19874221d902540e472079fe1277d45ec
Change logic how to show and hide the search filters. Now we iterate over the
list of defined filters for the selected query and show all matching filters.
If no filter is configured at all the whole filter widget is hidden.
diff -r 9a2c04b19874 -r c5d7fae5997a app/controller/Sql.js
--- a/app/controller/Sql.js Tue Jul 23 14:16:41 2013 +0200
+++ b/app/controller/Sql.js Tue Jul 23 14:18:11 2013 +0200
@@ -1,4 +1,5 @@
var queries = new Array('query1', 'query2');
+
Ext.define('Lada.controller.Sql', {
extend: 'Ext.app.Controller',
stores: [
@@ -31,18 +32,32 @@
},
selectSql: function(element, record, index) {
var result = Ext.getCmp('result');
- var selection = element.getValue() - 1;
- console.log('Selected SQL ' + selection);
- for (var i = 0; i < queries.length; ++i) {
- var toHide = Ext.getCmp(queries[i]);
- toHide.hide();
- }
- var toShow = Ext.getCmp(queries[selection]);
+ var filters = Ext.getCmp('queryfilters');
var buttons = Ext.getCmp('SearchBtnPanel');
+ var displayFields = record[0].data.fields;
+ var filterFields = record[0].data.filters;
this.reset();
- var displayFields = record[0].data.fields
+
+ // Setup Columns of the probenlist
result.setupColumns(displayFields);
- toShow.show();
+
+ // Setup Columns of the probenlist
+ if (filterFields.length > 0) {
+ var items = filters.items.items;
+ for (var i=0; i < items.length; i++) {
+ var filtername = items[i].id;
+ items[i].hide();
+ for (var j=0; j < filterFields.length; j++) {
+ if ('filter-'+filterFields[j] === filtername) {
+ items[i].show();
+ };
+ };
+
+ };
+ filters.show();
+ } else {
+ filters.hide();
+ };
buttons.show();
},
search: function(element, record, index) {
@@ -77,10 +92,10 @@
reset: function(element, record, index) {
var buttons = Ext.getCmp('SearchBtnPanel');
var result = Ext.getCmp('result');
- for (var i = 0; i < queries.length; ++i) {
- var toHide = Ext.getCmp(queries[i]);
- toHide.hide();
- }
+ //for (var i = 0; i < queries.length; ++i) {
+ // var toHide = Ext.getCmp(queries[i]);
+ // toHide.hide();
+ //}
//result.hide();
//buttons.hide();
}
diff -r 9a2c04b19874 -r c5d7fae5997a app/view/search/Query1.js
--- a/app/view/search/Query1.js Tue Jul 23 14:16:41 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-Ext.define('Lada.view.search.Query1' ,{
- extend: 'Ext.form.FieldSet',
- title: 'Variablenbelegung',
- alias: 'widget.query1',
- requires: [
- 'Lada.view.widgets.Mst',
- 'Lada.view.widgets.Uwb'
- ],
- initComponent: function() {
- this.items = [
- {
- id: 'mst',
- xtype: 'mst',
- fieldLabel: 'Messstelle',
- labelWidth: 100
- },
- {
- id: 'uwb',
- xtype: 'uwb',
- fieldLabel: 'Umweltbereich',
- labelWidth: 100
- }
- ];
- this.callParent(arguments);
- }
-});
diff -r 9a2c04b19874 -r c5d7fae5997a app/view/search/Query2.js
--- a/app/view/search/Query2.js Tue Jul 23 14:16:41 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-Ext.define('Lada.view.search.Query2' ,{
- extend: 'Ext.form.FieldSet',
- alias: 'widget.query2',
- title: 'Variablenbelegung (Zeiten in UTC)',
- requires: [
- 'Lada.view.widgets.Datetime'
- ],
- initComponent: function() {
- this.items = [
- {
- id: 'pbegin',
- xtype: 'datetime',
- fieldLabel: 'Probenbeginn',
- labelWidth: 100
- }
- ];
- this.callParent(arguments);
- }
-});
More information about the Lada-commits
mailing list