[Lada-commits] [PATCH 1 of 2] Load unknown ort and refresh ortzuordnungs grid
Wald Commits
scm-commit at wald.intevation.org
Wed Dec 14 10:21:51 CET 2016
# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1481707252 -3600
# Node ID 3d83bcb02ee32370933d8d572b77564ea42b43f9
# Parent 96f9417c105ea312943ddce3c1b67ed816303b0d
Load unknown ort and refresh ortzuordnungs grid.
diff -r 96f9417c105e -r 3d83bcb02ee3 app/view/grid/Ortszuordnung.js
--- a/app/view/grid/Ortszuordnung.js Mon Nov 28 08:28:53 2016 +0100
+++ b/app/view/grid/Ortszuordnung.js Wed Dec 14 10:20:52 2016 +0100
@@ -31,6 +31,7 @@
allowDeselect: true,
initComponent: function() {
+ var me = this;
this.dockedItems = [{
xtype: 'toolbar',
dock: 'bottom',
@@ -75,6 +76,21 @@
renderer: function(value) {
var store = Ext.data.StoreManager.get('orte');
var record = store.getById(value);
+ if (!record) {
+ record = Ext.create('Lada.model.Ort');
+ record.set('id', value);
+ store.add(record);
+ Lada.model.Ort.load(value, {
+ success: function(rec) {
+ record.beginEdit();
+ for (key in rec.getData()) {
+ record.set(key, rec.getData()[key]);
+ }
+ record.endEdit();
+ me.getView().refresh();
+ }
+ });
+ }
return record.get('ortId');
}
}, {
@@ -84,8 +100,11 @@
renderer: function(value) {
var store = Ext.data.StoreManager.get('orte');
var staaten = Ext.data.StoreManager.get('staaten');
- var record =
- staaten.getById(store.getById(value).get('staatId'));
+ var ortRecord = store.getById(value);
+ if (!ortRecord || ortRecord.get('staatId') === '') {
+ return '';
+ }
+ var record = staaten.getById(ortRecord.get('staatId'));
return record.get('staatIso');
}
}, {
@@ -95,6 +114,9 @@
renderer: function(value) {
var store = Ext.data.StoreManager.get('orte');
var record = store.getById(value);
+ if (!record || record.get('gemId') === '') {
+ return '';
+ }
return record.get('gemId');
}
}, {
@@ -106,6 +128,9 @@
var gemeinden =
Ext.data.StoreManager.get('verwaltungseinheiten');
var record = store.getById(value);
+ if (!record || record.get('gemId') === '') {
+ return '';
+ }
var gemid = record.get('gemId');
var record2 = gemeinden.getById(gemid);
return record2.get('bezeichnung');
@@ -117,6 +142,9 @@
renderer: function(value) {
var store = Ext.data.StoreManager.get('orte');
var record = store.getById(value);
+ if (!record || record.get('anlageId') === '') {
+ return '';
+ }
return record.get('anlageId');
}
}];
More information about the Lada-commits
mailing list