changeset 1336:f879c806f880

Create orte store for grid to have only orte with the correct netzbetreiberId
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 03 Feb 2017 17:43:23 +0100
parents cba4e0b0e336
children 7194964183f4
files app/controller/form/Ortszuordnung.js
diffstat 1 files changed, 27 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/form/Ortszuordnung.js	Fri Feb 03 17:02:55 2017 +0100
+++ b/app/controller/form/Ortszuordnung.js	Fri Feb 03 17:43:23 2017 +0100
@@ -150,7 +150,33 @@
             map.featureLayer.setVisibility(true);
             win.setY(25);
             gridPanel.show();
-            osg.store.load({params: {netzbetreiberId: oForm.record.get('netzbetreiberId')}});
+            var mstId = oForm.up('window').probe ? oForm.up('window').probe.get('mstId') :
+                oForm.up('window').messprogramm.get('mstId');
+            var mst = Ext.data.StoreManager.get('messstellen');
+            var ndx = mst.findExact('id', mstId);
+            var nId = mst.getAt(ndx).get('netzbetreiberId');
+            var store = Ext.create('Lada.store.Orte', {
+                defaultPageSize: 0,
+                listeners: {
+                    beforeload: {
+                        fn: function() {
+                            osg.setLoading(true);
+                        }
+                    },
+                    load: {
+                        fn: function() {
+                            osg.setLoading(false);
+                            osg.setStore(store);
+                            osg.store.filterBy(function(record) {
+                                if (record.get('netzbetreiberId') ===
+                                    nId) {
+                                        return true;
+                                    }
+                            });
+                        }
+                    }
+                }
+            });
             win.doLayout();
             osg.addListener('select',oForm.setOrt, oForm);
 

http://lada.wald.intevation.org