Mercurial > lada > lada-client
changeset 957:881984972e0e
Added Statusstufe to MessungForm
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Mon, 09 Nov 2015 14:13:27 +0100 |
parents | 45c67a784b31 |
children | 5d57c6c53e20 |
files | app/view/form/Messung.js app/view/grid/Status.js resources/i18n/Lada_de-DE.properties |
diffstat | 3 files changed, 67 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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); },
--- 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'; }
--- 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