[Lada-commits] [PATCH] Create orte store for grid to have only orte with the correct netzbetreiberId

Wald Commits scm-commit at wald.intevation.org
Fri Feb 3 17:43:34 CET 2017


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1486140203 -3600
# Node ID f879c806f880ab3373ef34fe0fb6fd126f9ef6e4
# Parent  cba4e0b0e336638bac438f6d585cf8c37d343455
Create orte store for grid to have only orte with the correct netzbetreiberId

diff -r cba4e0b0e336 -r f879c806f880 app/controller/form/Ortszuordnung.js
--- 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);
 


More information about the Lada-commits mailing list