changeset 1373:94d35d5a7913

update other panels if ortegrid changes
author Maximilian Krambach <mkrambach@intevation.de>
date Thu, 09 Feb 2017 11:54:22 +0100
parents f2db1da82297
children bf41823cdcf2
files app/controller/Ort.js app/view/panel/Map.js
diffstat 2 files changed, 38 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/Ort.js	Thu Feb 09 11:19:03 2017 +0100
+++ b/app/controller/Ort.js	Thu Feb 09 11:54:22 2017 +0100
@@ -124,22 +124,37 @@
         var i18n = Lada.getApplication().bundle;
         context.record.save({
             success: function(record, response) {
+                Ext.StoreManager.get('orte').load();
                 var grid = Ext.ComponentQuery.query('ortstammdatengrid')[0];
-                grid.store.load();
-                Ext.StoreManager.get('orte').load();
+                grid.store.load({
+                    callback: function() {
+                        var map = Ext.ComponentQuery.query('map')[0];
+                        map.addLocations(grid.store);
+                        var parentPanel = grid.up('panel').ownerCt;
+                        if (parentPanel){
+                            if (parentPanel.ortstore) {
+                                parentPanel.ortstore.load();
+                            }
+                            var ozf = parentPanel.down('ortszuordnungform');
+                            if (ozf){
+                                ozf.setOrt(null, record);
+                            }
+                        }
+                    }
+                });
             },
             failure: function(record, response) {
-              var json = response.request.scope.reader.jsonData;
-              if (json) {
-                if (json.message){
-                    Ext.Msg.alert(i18n.getMsg('err.msg.save.title')
-                        +' #'+json.message,
-                        i18n.getMsg(json.message));
-                   } else {
-                         Ext.Msg.alert(i18n.getMsg('err.msg.save.title'),
-                            i18n.getMsg('err.msg.generic.body'));
-                   }
-              }
+                var json = response.request.scope.reader.jsonData;
+                if (json) {
+                    if (json.message){
+                        Ext.Msg.alert(i18n.getMsg('err.msg.save.title')
+                            +' #'+json.message,
+                            i18n.getMsg(json.message));
+                    } else {
+                        Ext.Msg.alert(i18n.getMsg('err.msg.save.title'),
+                                      i18n.getMsg('err.msg.generic.body'));
+                    }
+                }
             }
         });
     },
--- a/app/view/panel/Map.js	Thu Feb 09 11:19:03 2017 +0100
+++ b/app/view/panel/Map.js	Thu Feb 09 11:54:22 2017 +0100
@@ -205,6 +205,16 @@
         }
         this.featureLayer.removeAllFeatures();
         this.featureLayer.addFeatures(locationFeatures);
+        if (this.selectedFeatureLayer && this.selectedFeatureLayer.features){
+            var oldSelection = this.selectedFeatureLayer.features[0].data.id;
+            var feature = this.featureLayer.getFeaturesByAttribute('id', oldSelection)[0];
+            this.selectControl.unselectAll();
+            this.selectedFeatureLayer.removeAllFeatures();
+            this.selectedFeatureLayer.addFeatures(feature.clone());
+            this.featureLayer.removeFeatures([feature]);
+            this.selectedFeatureLayer.refresh({force: true});
+            this.featureLayer.refresh({force: true});
+        }
         this.map.addLayer(this.featureLayer);
     },
 

http://lada.wald.intevation.org