diff app/controller/form/Ort.js @ 615:3d33c65319f3

Update feature selection on 'ort' selection change.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 13 Mar 2015 16:28:37 +0100
parents 9d0113bc2f70
children 5b5bba1d8e6a
line wrap: on
line diff
--- a/app/controller/form/Ort.js	Fri Mar 13 16:27:33 2015 +0100
+++ b/app/controller/form/Ort.js	Fri Mar 13 16:28:37 2015 +0100
@@ -57,12 +57,16 @@
                 }
             }
         });
-        console.log('save');
     },
 
     discard: function(button) {
         var formPanel = button.up('form');
         formPanel.getForm().loadRecord(formPanel.getForm().getRecord());
+        var win = button.up('window');
+        var id = formPanel.getForm().getRecord().get('ort');
+        var toLoad = Ext.data.StoreManager.get('locations').getById(id);
+        win.down('locationform').setRecord(toLoad);
+        win.down('map').selectFeature(id);
     },
 
     dirtyForm: function(form, dirty) {
@@ -77,20 +81,13 @@
     },
 
     updateDetails: function(combobox, record) {
-        console.log(record);
         var win = combobox.up('window');
         var details = win.down('locationform');
         var id = record[0].get('id');
         if (details) {
-            Ext.ClassManager.get('Lada.model.Location').load(id, {
-                failure: function(record, action) {
-                    // TODO
-                },
-                success: function(record, response) {
-                    win.down('locationform').setRecord(record);
-                },
-                scope: this
-            });
+            var toLoad = Ext.data.StoreManager.get('locations').getById(id);
+            win.down('locationform').setRecord(toLoad);
+            win.down('map').selectFeature(id);
         }
     }
 });

http://lada.wald.intevation.org