comparison 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
comparison
equal deleted inserted replaced
1028:2e7adc19b4fe 1049:1bd4c0709bd6
9 9
10 width: '100%', 10 width: '100%',
11 //height: 200, 11 //height: 200,
12 12
13 layout: { 13 layout: {
14 type: 'border', 14 type: 'border'
15 }, 15 },
16 toolbarPos: 'top', 16 toolbarPos: 'top',
17 17
18 initComponent: function() { 18 initComponent: function() {
19 var i18n = Lada.getApplication().bundle; 19 var i18n = Lada.getApplication().bundle;
67 67
68 this.items = [{ 68 this.items = [{
69 xtype: 'ortstammdatengrid', 69 xtype: 'ortstammdatengrid',
70 width: '60%', 70 width: '60%',
71 collapsible: true, 71 collapsible: true,
72 region: 'east', 72 region: 'east'
73 }, { 73 }, {
74 xtype: 'map', 74 xtype: 'map',
75 region: 'center', 75 region: 'center',
76 layout: 'border', 76 layout: 'border',
77 title: i18n.getMsg('map.title'), 77 title: i18n.getMsg('map.title'),
83 }, 83 },
84 expand: function() { 84 expand: function() {
85 this.map.addControl(new OpenLayers.Control.ScaleLine()); 85 this.map.addControl(new OpenLayers.Control.ScaleLine());
86 } 86 }
87 } 87 }
88 }], 88 }];
89 89
90 this.callParent(arguments); 90 this.callParent(arguments);
91 },
92
93 afterRender: function() {
94 this.superclass.afterRender.apply(this, arguments);
95 this.down('map').map.zoomToMaxExtent();
91 }, 96 },
92 97
93 setStore: function(store) { 98 setStore: function(store) {
94 var me = this; 99 var me = this;
95 var osg = this.down('ortstammdatengrid'); 100 var osg = this.down('ortstammdatengrid');
96 var map = this.down('map'); 101 var map = this.down('map');
102 console.log(map);
97 103
98 if (!store) { 104 if (!store) {
99 var ortstore = Ext.create('Lada.store.Orte', { 105 var ortstore = Ext.create('Lada.store.Orte', {
100 defaultPageSize: 0, 106 defaultPageSize: 0,
101 listeners: { 107 listeners: {
109 fn: function() { 115 fn: function() {
110 osg.setLoading(false); 116 osg.setLoading(false);
111 map.setLoading(false); 117 map.setLoading(false);
112 osg.setStore(ortstore); 118 osg.setStore(ortstore);
113 map.addLocations(ortstore); 119 map.addLocations(ortstore);
114
115 } 120 }
116 } 121 }
117 } 122 }
118 }); 123 });
119 } 124 }
120 else { 125 else {
121 osg.setStore(store); 126 osg.setStore(store);
122 map.addLocations(store); 127 map.addLocations(store);
123 } 128 }
129 this.connectListeners();
124 //enable buttons 130 //enable buttons
125 me.down('toolbar button[action=add]').enable(); 131 me.down('toolbar button[action=add]').enable();
126 me.down('toolbar button[action=addMap]').enable(); 132 me.down('toolbar button[action=addMap]').enable();
133 },
134
135 getStore: function() {
136 return this.down('grid').getStore();
137 },
138
139 connectListeners: function() {
140 var osg = this.down('ortstammdatengrid');
141 var map = this.down('map');
142 map.addListener('featureselected', osg.selectOrt, osg);
143 osg.addListener('select', map.selectFeature, map);
127 } 144 }
128 }); 145 });

http://lada.wald.intevation.org