Mercurial > lada > lada-client
diff app/view/window/OrtCreate.js @ 796:7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Wed, 20 May 2015 14:19:12 +0200 |
parents | 6f6d2df00130 |
children | def27cdd0dfa |
line wrap: on
line diff
--- a/app/view/window/OrtCreate.js Mon May 18 17:04:32 2015 +0200 +++ b/app/view/window/OrtCreate.js Wed May 20 14:19:12 2015 +0200 @@ -6,8 +6,8 @@ * the documentation coming with IMIS-Labordaten-Application for details. */ -/* - * Window to edit a Messung +/** + * Window to create a Ort */ Ext.define('Lada.view.window.OrtCreate', { extend: 'Ext.window.Window', @@ -78,7 +78,10 @@ bodyStyle: { background: '#fff' }, - name: 'map' + name: 'map', + listeners: { //A listener which listens to the mappanels featureselected event + featureselected: this.selectedFeature + } }] }]; this.callParent(arguments); @@ -91,6 +94,34 @@ this.down('ortform').setRecord(ort); }, + /** + * @private + * Override to display and update the map view in the panel. + */ + afterRender: function(){ + this.superclass.afterRender.apply(this, arguments); + var map = this.down('map'); + map.map.zoomToMaxExtent(); + }, + + /** + * This function is used by the MapPanel, when a Feature was selected + */ + selectedFeature: function(context, args) { + var feature = args[0]; + if (feature.attributes.id && + feature.attributes.id !== '') { + var record = Ext.data.StoreManager.get('locations').getById(feature.attributes.id); + context.up('window').down('locationform').setRecord(record); + context.up('window').down('locationform').setReadOnly(true); + context.up('window').down('ortform').down('combobox').setValue(record.id); + } + else { + context.up('window').down('locationform').setRecord(this.locationRecord); + context.up('window').down('locationform').setReadOnly(false); + } + }, + setMessages: function(errors, warnings) { //todo this is a stub },