changeset 1364:b58868c47f02

reintroduced filtered display of Stammdaten panel
author Maximilian Krambach <mkrambach@intevation.de>
date Wed, 08 Feb 2017 12:53:24 +0100 (2017-02-08)
parents d52d4b55914b
children e98ec562764f
files app/controller/form/Messprogramm.js app/controller/form/Ortserstellung.js app/view/panel/Ort.js
diffstat 3 files changed, 25 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/form/Messprogramm.js	Wed Feb 08 12:06:52 2017 +0100
+++ b/app/controller/form/Messprogramm.js	Wed Feb 08 12:53:24 2017 +0100
@@ -154,7 +154,6 @@
     save: function(button) {
         var formPanel = button.up('form');
         var data = formPanel.getForm().getFieldValues();
-        var orte = Ext.data.StoreManager.get('orte');
         for (var key in data) {
             formPanel.getForm().getRecord().set(key, data[key]);
         }
--- a/app/controller/form/Ortserstellung.js	Wed Feb 08 12:06:52 2017 +0100
+++ b/app/controller/form/Ortserstellung.js	Wed Feb 08 12:53:24 2017 +0100
@@ -73,13 +73,18 @@
                 if (ozw.ortstore) {
                     ozw.ortstore.load({
                         callback: function(records, operation, success) {
-                            me.afterSave(formpanel, ozw.ortstore, json);
+                            ozw.down('map').addLocations(ozw.ortstore);
+                            var osg = ozw.down('ortstammdatengrid');
+                            osg.setStore(ozw.ortstore);
+                            me.afterSave(formpanel, json);
                         },
                         scope: this
                     });
                 } else {
-                    ozw.setStore();
-                    me.afterSave(formpanel, ozw.getStore(), json);
+                    var osgstore = ozw.down('ortstammdatengrid').getStore();
+                    osgstore.load();
+                    ozw.down('map').addLocations(osgstore);
+                    me.afterSave(formpanel, json);
                 }
             },
             failure: function(record, response) {
@@ -93,8 +98,8 @@
                          Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
                              Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
                     }
-                    me.clearMessages();
-                    me.setMessages(json.errors, json.warnings);
+                    formpanel.clearMessages();
+                    formpanel.setMessages(json.errors, json.warnings);
                 } else {
                     Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
                         Lada.getApplication().bundle.getMsg('err.msg.response.body'));
@@ -106,15 +111,15 @@
     /**
      * Callbacks after a Ort has been saved and the store is reloaded
      */
-    afterSave: function(form, store, json) {
+    afterSave: function(form, json) {
         var ozw = form.up('panel').parentWindow;
-        ozw.down('map').addLocations(ozw.ortstore);
         var osg = ozw.down('ortstammdatengrid');
-        osg.setStore(ozw.ortstore);
         var id = json.data.id;
         var record = osg.store.getById(id);
-        var selmod = osg.getView().getSelectionModel();
-        selmod.select(record);
+        if (record) {
+            var selmod = osg.getView().getSelectionModel();
+            selmod.select(record);
+        }
         var resulttext;
         if (json) {
             if (json.message == '201') {
--- a/app/view/panel/Ort.js	Wed Feb 08 12:06:52 2017 +0100
+++ b/app/view/panel/Ort.js	Wed Feb 08 12:53:24 2017 +0100
@@ -90,11 +90,6 @@
             }
         }];
         this.callParent(arguments);
-        var map = this.down('map');
-        var osg = this.down('ortstammdatengrid');
-        osg.setLoading(true);
-        map.setLoading(true);
-        this.setStore();
     },
 
     afterRender: function() {
@@ -108,30 +103,20 @@
         var map = this.down('map');
         osg.setLoading(true);
         map.setLoading(true);
-
-        if (!store) {
-            this.ortstore = Ext.data.StoreManager.get('orte');
-            //this.ortstore.clearFilter(true);
-        } else {
-            this.ortstore = store;
+        var ortstore = store;
+        if (!ortstore) {
+            ortstore = Ext.data.StoreManager.get('orte');
         }
-        // store.clearFilter(true);
-        this.ortstore.load({
-            callback: function() {
-                osg.setStore(me.ortstore);
-                map.addLocations(me.ortstore);
-                osg.setLoading(false);
-                map.setLoading(false);
-            }
-        });
-        //enable buttons
-        this.down('toolbar button[action=add]').enable();
-        this.down('toolbar button[action=addMap]').enable();
-        this.connectListeners();
+        ortstore.clearFilter(true);
+        osg.setStore(ortstore);
+        map.addLocations(ortstore);
+        me.down('toolbar button[action=add]').enable();
+        me.down('toolbar button[action=addMap]').enable();
+        me.connectListeners();
     },
 
     getStore: function() {
-        return this.ortstore;
+        return this.down('grid').getStore();
     },
 
     connectListeners: function() {

http://lada.wald.intevation.org