[Lada-commits] [PATCH 1 of 5] Added Statusstufe to MessungForm
Wald Commits
scm-commit at wald.intevation.org
Tue Nov 10 13:09:32 CET 2015
# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1447074807 -3600
# Node ID 881984972e0e0c1e70424c2ccb30ce09c042dde6
# Parent 45c67a784b31f02a2b6ffa51f72afd8832674e30
Added Statusstufe to MessungForm
diff -r 45c67a784b31 -r 881984972e0e app/view/form/Messung.js
--- a/app/view/form/Messung.js Mon Nov 09 13:31:43 2015 +0100
+++ b/app/view/form/Messung.js Mon Nov 09 14:13:27 2015 +0100
@@ -129,6 +129,22 @@
validateValue: function() {
return true; //this field is always valid
},
+ }, {
+ xtype: 'textfield',
+ name: 'stufe',
+ readOnly: true,
+ isFormField: false,
+ maxLength: 10,
+ margin: '0, 10, 5, 0',
+ fieldLabel: 'Stufe',
+ width: 300,
+ labelWidth: 100,
+ submitValue: false,
+ isFormField: false,
+ preventMark: true, //Do not display error msg.
+ validateValue: function() {
+ return true; //this field is always valid
+ },
}]
}]
}];
@@ -153,15 +169,17 @@
}
sStore.on('load',
function(records, operation, success) {
- var ret;
+ var sw, ss;
var i18n = Lada.getApplication().bundle;
if (sStore.getTotalCount() === 0 || !statusId) {
- ret = 0;
+ sw = 0;
}
else {
- ret = sStore.getById(statusId).get('statusWert');
+ sw = sStore.getById(statusId).get('statusWert');
+ ss = sStore.getById(statusId).get('statusStufe');
}
- this.setStatusWert(ret);
+ this.setStatusWert(sw);
+ this.setStatusStufe(ss);
},
this);
sStore.load({
@@ -171,6 +189,9 @@
});
},
+ /**
+ * Updates the Messungform and fills the Statuswert
+ */
setStatusWert: function(value){
var swStore = Ext.StoreManager.lookup('StatusWerte');
if (!swStore) {
@@ -183,7 +204,35 @@
var msg = i18n.getMsg('load.statuswert.error');
var textfield = this.down('[name=status]');
if (success) {
- msg = swStore.getById(value).get('wert');
+ var item = swStore.getById(value);
+ if (item) {
+ msg = item.get('wert');
+ }
+ }
+ textfield.setRawValue(msg);
+ },
+ });
+ },
+
+ /**
+ * Updates the Messungform and fills the StatusStufe
+ */
+ setStatusStufe: function(value){
+ var ssStore = Ext.StoreManager.lookup('StatusStufe');
+ if (!ssStore) {
+ var ssStore = Ext.create('Lada.store.StatusStufe');
+ }
+ ssStore.load({
+ scope: this,
+ callback: function(records, operation, success) {
+ var i18n = Lada.getApplication().bundle;
+ var msg = i18n.getMsg('load.statusstufe.error');
+ var textfield = this.down('[name=stufe]');
+ if (success) {
+ var item = ssStore.getById(value);
+ if (item) {
+ msg = item.get('stufe');
+ }
}
textfield.setRawValue(msg);
},
diff -r 45c67a784b31 -r 881984972e0e app/view/grid/Status.js
--- a/app/view/grid/Status.js Mon Nov 09 13:31:43 2015 +0100
+++ b/app/view/grid/Status.js Mon Nov 09 14:13:27 2015 +0100
@@ -95,10 +95,14 @@
header: 'Stufe',
dataIndex: 'statusStufe',
renderer: function(value) {
- if (value===null || value === '' || value === 0) {
+ if (value===null || value === '') {
return 'Fehlerhafte Daten';
}
- var r = statusStufeStore.getById(value).get('stufe')
+ var item = statusStufeStore.getById(value);
+ var r;
+ if (item) {
+ r = item.get('stufe');
+ }
if (r === null) {
r = 'Error';
}
@@ -120,7 +124,11 @@
if (value===null || value === '') {
return '';
}
- var r = statusWerteStore.getById(value).get('wert')
+ var item = statusWerteStore.getById(value);
+ var r;
+ if (item) {
+ r = item.get('wert');
+ }
if (r === null) {
r = 'Error';
}
diff -r 45c67a784b31 -r 881984972e0e resources/i18n/Lada_de-DE.properties
--- a/resources/i18n/Lada_de-DE.properties Mon Nov 09 13:31:43 2015 +0100
+++ b/resources/i18n/Lada_de-DE.properties Mon Nov 09 14:13:27 2015 +0100
@@ -101,7 +101,9 @@
load.statuswert:Lade aktuellen Statuswert...
+load.statusstufe:Lade aktuelle Statusstufe...
load.statuswert.error:Fehler beim auflösen der Statuswerte
+load.statusstufe.error:Fehler beim auflösen der Statusstufe
# Actions
add:Hinzufügen
More information about the Lada-commits
mailing list