Mercurial > lada > lada-client
changeset 961:6f1cc3316e2d
Intermediate Result. When creating a Messung a Statuswert will be set.
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Tue, 10 Nov 2015 13:07:57 +0100 |
parents | 73b397d8dd3a |
children | 9b6800458a9e |
files | app/view/form/Messung.js app/view/grid/Status.js |
diffstat | 2 files changed, 34 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/app/view/form/Messung.js Tue Nov 10 12:16:19 2015 +0100 +++ b/app/view/form/Messung.js Tue Nov 10 13:07:57 2015 +0100 @@ -155,7 +155,7 @@ var form = this.getForm(); form.loadRecord(record); if (record.getId()){ - this.retrieveStatus(record.id, record.get('status')); + this.retrieveStatus(record.getId(), record.get('status')); } else { //remove the StatusWert and StatusStufe field from the form @@ -171,14 +171,16 @@ var msg = i18n.getMsg('load.statuswert'); var textfield = this.down('[name=status]'); - textfield.setRawValue(msg); + if(textfield) { + textfield.setRawValue(msg); + } - var sStore = Ext.StoreManager.lookup('Status'); - if (!sStore) { - sStore = Ext.create('Lada.store.Status'); - } - sStore.on('load', - function(records, operation, success) { + var sStore = Ext.create('Lada.store.Status'); + sStore.load({ + params: { + messungsId: messungsId + }, + callback: function(records, operation, success) { var sw, ss; var i18n = Lada.getApplication().bundle; if (sStore.getTotalCount() === 0 || !statusId) { @@ -191,11 +193,7 @@ this.setStatusWert(sw); this.setStatusStufe(ss); }, - this); - sStore.load({ - params: { - messungsId: messungsId - } + scope: this }); }, @@ -216,7 +214,9 @@ msg = item.get('wert'); } } - textfield.setRawValue(msg); + if (textfield) { + textfield.setRawValue(msg); + } }, }); }, @@ -238,7 +238,9 @@ msg = item.get('stufe'); } } - textfield.setRawValue(msg); + if (textfield) { + textfield.setRawValue(msg); + } }, }); },
--- a/app/view/grid/Status.js Tue Nov 10 12:16:19 2015 +0100 +++ b/app/view/grid/Status.js Tue Nov 10 13:07:57 2015 +0100 @@ -47,9 +47,17 @@ this.plugins = [this.rowEditing]; var statusWerteStore = Ext.create('Lada.store.StatusWerte'); - statusWerteStore.load(); //add params messungid + statusWerteStore.load({ + //params: { + // messungsId: this.recordId + //} + }); var statusStufeStore = Ext.create('Lada.store.StatusStufe'); - statusStufeStore.load(); //add params messungid + statusStufeStore.load({ + //params: { + // messungsId: this.recordId + //} + }); this.dockedItems = [{ xtype: 'toolbar', dock: 'bottom', @@ -76,11 +84,16 @@ header: 'Erzeuger', dataIndex: 'erzeuger', renderer: function(value) { + var r = ''; if (!value || value === '') { - return ''; + r = 'Error'; } var mstore = Ext.data.StoreManager.get('messstellen'); - return mstore.getById(value).get('messStelle'); + var item = mstore.getById(value); + if (item) { + r = item.get('messStelle'); + } + return r; }, editor: { xtype: 'combobox', @@ -105,14 +118,6 @@ } return r; }, - editor: { - xtype: 'combobox', - store: statusStufeStore, - displayField: 'stufe', - valueField: 'id', - allowBlank: false, - editable: false - }, sortable: false, }, { header: 'Status',