diff app/view/panel/Ort.js @ 1049:1bd4c0709bd6 stammdatengrids

Working version of selectable 'ort' in map and grid.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 01 Mar 2016 11:50:39 +0100
parents 1df6b6210b42
children e0b5e64928c9
line wrap: on
line diff
--- a/app/view/panel/Ort.js	Tue Feb 16 09:04:05 2016 +0100
+++ b/app/view/panel/Ort.js	Tue Mar 01 11:50:39 2016 +0100
@@ -11,7 +11,7 @@
     //height: 200,
 
     layout: {
-        type: 'border',
+        type: 'border'
     },
     toolbarPos: 'top',
 
@@ -69,7 +69,7 @@
             xtype: 'ortstammdatengrid',
             width: '60%',
             collapsible: true,
-            region: 'east',
+            region: 'east'
         }, {
             xtype: 'map',
             region: 'center',
@@ -85,15 +85,21 @@
                     this.map.addControl(new OpenLayers.Control.ScaleLine());
                 }
             }
-        }],
+        }];
 
         this.callParent(arguments);
     },
 
+    afterRender: function() {
+        this.superclass.afterRender.apply(this, arguments);
+        this.down('map').map.zoomToMaxExtent();
+    },
+
     setStore: function(store) {
         var me = this;
         var osg = this.down('ortstammdatengrid');
         var map = this.down('map');
+        console.log(map);
 
         if (!store) {
             var ortstore = Ext.create('Lada.store.Orte', {
@@ -111,7 +117,6 @@
                             map.setLoading(false);
                             osg.setStore(ortstore);
                             map.addLocations(ortstore);
-
                         }
                     }
                 }
@@ -121,8 +126,20 @@
             osg.setStore(store);
             map.addLocations(store);
         }
+        this.connectListeners();
         //enable buttons
         me.down('toolbar button[action=add]').enable();
         me.down('toolbar button[action=addMap]').enable();
+    },
+
+    getStore: function() {
+        return this.down('grid').getStore();
+    },
+
+    connectListeners: function() {
+        var osg = this.down('ortstammdatengrid');
+        var map = this.down('map');
+        map.addListener('featureselected', osg.selectOrt, osg);
+        osg.addListener('select', map.selectFeature, map);
     }
 });

http://lada.wald.intevation.org