[Lada-commits] [PATCH] update other panels if ortegrid changes
Wald Commits
scm-commit at wald.intevation.org
Thu Feb 9 11:54:26 CET 2017
# HG changeset patch
# User Maximilian Krambach <mkrambach at intevation.de>
# Date 1486637662 -3600
# Node ID 94d35d5a7913ec936eacd112d961d7f7ba6becf6
# Parent f2db1da82297e8e46ed1ecfe3fc61cc6b416e593
update other panels if ortegrid changes
diff -r f2db1da82297 -r 94d35d5a7913 app/controller/Ort.js
--- a/app/controller/Ort.js Thu Feb 09 11:19:03 2017 +0100
+++ b/app/controller/Ort.js Thu Feb 09 11:54:22 2017 +0100
@@ -124,22 +124,37 @@
var i18n = Lada.getApplication().bundle;
context.record.save({
success: function(record, response) {
+ Ext.StoreManager.get('orte').load();
var grid = Ext.ComponentQuery.query('ortstammdatengrid')[0];
- grid.store.load();
- Ext.StoreManager.get('orte').load();
+ grid.store.load({
+ callback: function() {
+ var map = Ext.ComponentQuery.query('map')[0];
+ map.addLocations(grid.store);
+ var parentPanel = grid.up('panel').ownerCt;
+ if (parentPanel){
+ if (parentPanel.ortstore) {
+ parentPanel.ortstore.load();
+ }
+ var ozf = parentPanel.down('ortszuordnungform');
+ if (ozf){
+ ozf.setOrt(null, record);
+ }
+ }
+ }
+ });
},
failure: function(record, response) {
- var json = response.request.scope.reader.jsonData;
- if (json) {
- if (json.message){
- Ext.Msg.alert(i18n.getMsg('err.msg.save.title')
- +' #'+json.message,
- i18n.getMsg(json.message));
- } else {
- Ext.Msg.alert(i18n.getMsg('err.msg.save.title'),
- i18n.getMsg('err.msg.generic.body'));
- }
- }
+ var json = response.request.scope.reader.jsonData;
+ if (json) {
+ if (json.message){
+ Ext.Msg.alert(i18n.getMsg('err.msg.save.title')
+ +' #'+json.message,
+ i18n.getMsg(json.message));
+ } else {
+ Ext.Msg.alert(i18n.getMsg('err.msg.save.title'),
+ i18n.getMsg('err.msg.generic.body'));
+ }
+ }
}
});
},
diff -r f2db1da82297 -r 94d35d5a7913 app/view/panel/Map.js
--- a/app/view/panel/Map.js Thu Feb 09 11:19:03 2017 +0100
+++ b/app/view/panel/Map.js Thu Feb 09 11:54:22 2017 +0100
@@ -205,6 +205,16 @@
}
this.featureLayer.removeAllFeatures();
this.featureLayer.addFeatures(locationFeatures);
+ if (this.selectedFeatureLayer && this.selectedFeatureLayer.features){
+ var oldSelection = this.selectedFeatureLayer.features[0].data.id;
+ var feature = this.featureLayer.getFeaturesByAttribute('id', oldSelection)[0];
+ this.selectControl.unselectAll();
+ this.selectedFeatureLayer.removeAllFeatures();
+ this.selectedFeatureLayer.addFeatures(feature.clone());
+ this.featureLayer.removeFeatures([feature]);
+ this.selectedFeatureLayer.refresh({force: true});
+ this.featureLayer.refresh({force: true});
+ }
this.map.addLayer(this.featureLayer);
},
More information about the Lada-commits
mailing list