[Lada-commits] [PATCH 2 of 3] Update feature selection on 'ort' selection change

Wald Commits scm-commit at wald.intevation.org
Fri Mar 13 16:28:12 CET 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1426260517 -3600
# Node ID 3d33c65319f3c6eceb43d03662cbd1becbc38392
# Parent  04e380ce4d7329a60474aad400253236749f4a8f
Update feature selection on 'ort' selection change.

diff -r 04e380ce4d73 -r 3d33c65319f3 app/controller/form/Ort.js
--- 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);
         }
     }
 });


More information about the Lada-commits mailing list