diff app/view/panel/Ort.js @ 1361:5c2d6812d85a

Merge behaviour of Stammdaten panel and ortszuordnungs grid according to the recent changes in Ortszuordnung and Ortserstellung.
author Maximilian Krambach <mkrambach@intevation.de>
date Tue, 07 Feb 2017 19:50:36 +0100
parents 195c5d9b234b
children b58868c47f02
line wrap: on
line diff
--- a/app/view/panel/Ort.js	Tue Feb 07 18:56:35 2017 +0100
+++ b/app/view/panel/Ort.js	Tue Feb 07 19:50:36 2017 +0100
@@ -89,8 +89,12 @@
                 }
             }
         }];
-
         this.callParent(arguments);
+        var map = this.down('map');
+        var osg = this.down('ortstammdatengrid');
+        osg.setLoading(true);
+        map.setLoading(true);
+        this.setStore();
     },
 
     afterRender: function() {
@@ -102,41 +106,32 @@
         var me = this;
         var osg = this.down('ortstammdatengrid');
         var map = this.down('map');
+        osg.setLoading(true);
+        map.setLoading(true);
 
         if (!store) {
-            var ortstore = Ext.create('Lada.store.Orte', {
-                defaultPageSize: 0,
-                listeners: {
-                    beforeload: {
-                        fn: function() {
-                            osg.setLoading(true);
-                            map.setLoading(true);
-                        }
-                    },
-                    load: {
-                        fn: function() {
-                            osg.setLoading(false);
-                            map.setLoading(false);
-                            osg.setStore(ortstore);
-                            map.addLocations(ortstore);
-                        }
-                    }
-                }
-            });
+            this.ortstore = Ext.data.StoreManager.get('orte');
+            //this.ortstore.clearFilter(true);
+        } else {
+            this.ortstore = store;
         }
-        else {
-            store.clearFilter(true);
-            osg.setStore(store);
-            map.addLocations(store);
-        }
+        // 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();
-        //enable buttons
-        me.down('toolbar button[action=add]').enable();
-        me.down('toolbar button[action=addMap]').enable();
     },
 
     getStore: function() {
-        return this.down('grid').getStore();
+        return this.ortstore;
     },
 
     connectListeners: function() {

http://lada.wald.intevation.org