changeset 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 04e380ce4d73
children dfc07fa0ceb1
files app/controller/form/Ort.js
diffstat 1 files changed, 8 insertions(+), 11 deletions(-) [+]
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