changeset 431:2375e7247523

Merged with @
author Torsten Irländer <torsten.irlaender@intevation.de>
date Fri, 08 Nov 2013 12:47:19 +0100
parents 4206cb30138c (diff) f0f6ae3aae52 (current diff)
children f4185f2d1a7c
files app/controller/Sql.js app/store/Verwaltungseinheiten.js
diffstat 7 files changed, 44 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/Sql.js	Thu Nov 07 12:14:36 2013 +0100
+++ b/app/controller/Sql.js	Fri Nov 08 12:47:19 2013 +0100
@@ -92,6 +92,7 @@
             var type = filterFields[j].type;
             var name = filterFields[j].dataIndex;
             var label = filterFields[j].label;
+            var multi = filterFields[j].multiSelect;
             var field = null;
             if (type == "text") {
                 console.log("Found text filter");
@@ -107,19 +108,19 @@
                 field = Ext.create('Lada.view.widgets.Testdatensatz', { name: name, fieldLabel: label, emptyText: '' });
             } else if (type == "listmst") {
                 console.log("Found listmst filter");
-                field = Ext.create('Lada.view.widgets.Mst', { name: name, fieldLabel: label });
+                field = Ext.create('Lada.view.widgets.Mst', { name: name, fieldLabel: label, multiSelect: multi });
             } else if (type == "listumw") {
                 console.log("Found listumw filter");
-                field = Ext.create('Lada.view.widgets.Uwb', { name: name, fieldLabel: label });
+                field = Ext.create('Lada.view.widgets.Uwb', { name: name, fieldLabel: label, multiSelect: multi });
             } else if (type == "listdbasis") {
                 console.log("Found listdbasis filter");
-                field = Ext.create('Lada.view.widgets.Datenbasis', { name: name, fieldLabel: label });
+                field = Ext.create('Lada.view.widgets.Datenbasis', { name: name, fieldLabel: label, multiSelect: multi });
             } else if (type == "listver") {
                 console.log("Found listver filter");
-                field = Ext.create('Lada.view.widgets.Verwaltungseinheit', { name: name, fieldLabel: label });
+                field = Ext.create('Lada.view.widgets.Verwaltungseinheit', { name: name, fieldLabel: label, multiSelect: multi });
             } else if (type == "listnetz") {
                 console.log("Found listnetz filter");
-                field = Ext.create('Lada.view.widgets.Netzbetreiber', { name: name, fieldLabel: label });
+                field = Ext.create('Lada.view.widgets.Netzbetreiber', { name: name, fieldLabel: label, multiSelect: multi });
             }
             if (field) {
                 console.log("Pushing field to filters");
--- a/app/store/Verwaltungseinheiten.js	Thu Nov 07 12:14:36 2013 +0100
+++ b/app/store/Verwaltungseinheiten.js	Fri Nov 08 12:47:19 2013 +0100
@@ -9,7 +9,7 @@
     }],
     autoLoad: false,
     proxy: {
-        type: 'ajax',
+        type: 'rest',
         api: {
         read: 'server/rest/verwaltungseinheit'
         },
--- a/app/view/Viewport.js	Thu Nov 07 12:14:36 2013 +0100
+++ b/app/view/Viewport.js	Fri Nov 08 12:47:19 2013 +0100
@@ -12,6 +12,7 @@
         'Lada.view.search.List',
         'Lada.view.proben.List'
     ],
+    layout: 'fit',
     initComponent: function() {
         console.log('Setting up Viewport');
         this.initSearch();
@@ -147,6 +148,10 @@
             xtype: 'panel',
             title: '<center>Probenauswahlmaske</center>',
             bodyPadding: '10 10',
+            layout: {
+                type: 'vbox',
+                align: 'stretch'
+            },
             dockedItems: [
                 {
                     xtype: "toolbar",
@@ -209,6 +214,7 @@
                 // Resultlist for the query.
                 {
                     id: 'result',
+                    flex: 1,
                     xtype: 'probenlist',
                     hidden: false
                 }
--- a/app/view/orte/CreateForm.js	Thu Nov 07 12:14:36 2013 +0100
+++ b/app/view/orte/CreateForm.js	Fri Nov 08 12:47:19 2013 +0100
@@ -18,14 +18,22 @@
                 listeners: {
                     scope: this,
                     'change': function (field, newv, oldv, opts) {
-                        console.log(field, oldv, newv, opts);
                         var orte = Ext.getStore('Ortedetails');
                         var ort = orte.getById(newv);
                         var fields = ['beschreibung', 'bezeichnung', 'hoeheLand',
                                       'latitude', 'longitude', 'staatId', 'gemId'];
+
+                        // Load currently "selected" verwaltungseinheit.  This
+                        // is needed as without having this record the field
+                        // would only display the raw value (id) of the
+                        // verwaltungseinheit.
+                        var verw = Ext.getStore('Verwaltungseinheiten');
+                        verw.load({
+                            id: ort.get('gemId')
+                        });
+
                         var form = this.getForm();
                         if ( ort != undefined ) {
-                            console.log('Found ort');
                             for (var i = fields.length - 1; i >= 0; i--){
                                 ffield = form.findField("ort_"+fields[i]);
                                 ffield.setValue(ort.get(fields[i]));
--- a/app/view/orte/List.js	Thu Nov 07 12:14:36 2013 +0100
+++ b/app/view/orte/List.js	Fri Nov 08 12:47:19 2013 +0100
@@ -37,7 +37,12 @@
         this.columns = [
             {
                 header: 'Typ',
-                dataIndex: 'ortsTyp'
+                dataIndex: 'ortId',
+                renderer: function(value) {
+                    var store = Ext.getStore('Ortedetails');
+                    var record = store.getById(value);
+                    return record.get('otyp');
+                }
             },
             {
                 header: 'Staat',
@@ -66,8 +71,7 @@
                 flex: 1,
                 renderer: function(value) {
                     var store = Ext.getStore('Ortedetails');
-                    var gemeinde = Ext.getStore('Verwaltungseinheiten');
-                    var record = gemeinde.findRecord('gemId', store.getById(value).get('gemId'));
+                    var record = store.getById(value);
                     return record.get('bezeichnung');
                 }
 
--- a/app/view/proben/List.js	Thu Nov 07 12:14:36 2013 +0100
+++ b/app/view/proben/List.js	Fri Nov 08 12:47:19 2013 +0100
@@ -7,11 +7,7 @@
     store: 'ProbenList',
     multiSelect: true,
     viewConfig: {
-        maxHeight: 350,
         emptyText: 'Keine Proben gefunden.',
-        // minHeight and deferEmptyText are needed to be able to show the
-        // emptyText message.
-        minHeight: 35,
         deferEmptyText: false
     },
     initComponent: function() {
--- a/app/view/widgets/Verwaltungseinheit.js	Thu Nov 07 12:14:36 2013 +0100
+++ b/app/view/widgets/Verwaltungseinheit.js	Fri Nov 08 12:47:19 2013 +0100
@@ -8,13 +8,24 @@
         displayField: 'bezeichnung',
         valueField: 'gemId',
         emptyText:'Wählen Sie eine Verwaltungseinheit',
+        hideTrigger: true,
         // Enable filtering of comboboxes
         autoSelect: false,
-        queryMode: 'local',
-        triggerAction : 'all',
+        queryMode: 'remote',
+        triggerAction : 'type',
         typeAhead: true,
-        minChars: 0,
+        minChars: 2,
     initComponent: function() {
         this.callParent(arguments);
+    },
+    // This listener is used to load currently "selected" verwaltungseinheit.
+    // This is needed as without having this record the field would only
+    // display the raw value (id) of the verwaltungseinheit.
+    listeners: {
+        render: function(combo, eOpts) {
+            combo.store.load({
+                id: this.getValue()
+            });
+        }
     }
 });

http://lada.wald.intevation.org