[Lada-commits] [PATCH] reintroduced filtered display of Stammdaten panel

Wald Commits scm-commit at wald.intevation.org
Wed Feb 8 12:53:27 CET 2017


# HG changeset patch
# User Maximilian Krambach <mkrambach at intevation.de>
# Date 1486554804 -3600
# Node ID b58868c47f0234e9ee02204a63a856453282a2ed
# Parent  d52d4b55914b2e93a6e10dd05b371cafef1d0b57
reintroduced filtered display of Stammdaten panel

diff -r d52d4b55914b -r b58868c47f02 app/controller/form/Messprogramm.js
--- 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]);
         }
diff -r d52d4b55914b -r b58868c47f02 app/controller/form/Ortserstellung.js
--- 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') {
diff -r d52d4b55914b -r b58868c47f02 app/view/panel/Ort.js
--- 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() {


More information about the Lada-commits mailing list