# HG changeset patch # User Dustin Demuth # Date 1447157277 -3600 # Node ID 6f1cc3316e2df422dd7712123393e29ac19b1c97 # Parent 73b397d8dd3aba1bb1b739582a7c57a6d279663d Intermediate Result. When creating a Messung a Statuswert will be set. diff -r 73b397d8dd3a -r 6f1cc3316e2d app/view/form/Messung.js --- 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); + } }, }); }, diff -r 73b397d8dd3a -r 6f1cc3316e2d app/view/grid/Status.js --- 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',