Mercurial > lada > lada-client
changeset 956:45c67a784b31
Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Mon, 09 Nov 2015 13:31:43 +0100 |
parents | b401846e7817 |
children | 881984972e0e |
files | app/model/Status.js app/model/StatusStufe.js app/model/StatusWerte.js app/store/StatusStufe.js app/view/grid/Status.js |
diffstat | 5 files changed, 90 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/app/model/Status.js Mon Nov 09 12:53:36 2015 +0100 +++ b/app/model/Status.js Mon Nov 09 13:31:43 2015 +0100 @@ -27,10 +27,12 @@ name: 'erzeuger' }, { name: 'statusStufe', - type: 'int' + type: 'int', + defaultValue: 1 }, { name: 'statusWert', - type: 'int' + type: 'int', + defaultValue: 0 }, { name: 'treeModified', serialize: function(value) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/model/StatusStufe.js Mon Nov 09 13:31:43 2015 +0100 @@ -0,0 +1,34 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ + +/** + * Model class for StatusWerte + */ +Ext.define('Lada.model.StatusStufe', { + extend: 'Ext.data.Model', + + fields: [{ + name: 'id' + }, { + name: 'stufe', + type: 'string' + }], + + idProperty: 'id', + + proxy: { + type: 'rest', + url: 'lada-server/statusstufe', + reader: { + type: 'json', + root: 'data' + } + } + +}); +
--- a/app/model/StatusWerte.js Mon Nov 09 12:53:36 2015 +0100 +++ b/app/model/StatusWerte.js Mon Nov 09 13:31:43 2015 +0100 @@ -15,7 +15,8 @@ fields: [{ name: 'id' }, { - name: 'wert' + name: 'wert', + type: 'string' }], idProperty: 'id',
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/store/StatusStufe.js Mon Nov 09 13:31:43 2015 +0100 @@ -0,0 +1,18 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ + +/** + * Store for Status-Werte + */ +Ext.define('Lada.store.StatusStufe', { + extend: 'Ext.data.Store', + model: 'Lada.model.StatusStufe', + autoLoad: true, + storeId: 'StatusStufe' +}); +
--- a/app/view/grid/Status.js Mon Nov 09 12:53:36 2015 +0100 +++ b/app/view/grid/Status.js Mon Nov 09 13:31:43 2015 +0100 @@ -46,8 +46,10 @@ }); this.plugins = [this.rowEditing]; - var statusStore = Ext.create('Lada.store.StatusWerte'); - statusStore.load(); + var statusWerteStore = Ext.create('Lada.store.StatusWerte'); + statusWerteStore.load(); + var statusStufeStore = Ext.create('Lada.store.StatusStufe'); + statusStufeStore.load(); this.dockedItems = [{ xtype: 'toolbar', dock: 'bottom', @@ -90,17 +92,43 @@ }, sortable: false, }, { + header: 'Stufe', + dataIndex: 'statusStufe', + renderer: function(value) { + if (value===null || value === '' || value === 0) { + return 'Fehlerhafte Daten'; + } + var r = statusStufeStore.getById(value).get('stufe') + if (r === null) { + r = 'Error'; + } + return r; + }, + editor: { + xtype: 'combobox', + store: statusStufeStore, + displayField: 'stufe', + valueField: 'id', + allowBlank: false, + editable: false + }, + sortable: false, + }, { header: 'Status', dataIndex: 'statusWert', renderer: function(value) { if (value===null || value === '') { return ''; } - return statusStore.getById(value).get('wert'); + var r = statusWerteStore.getById(value).get('wert') + if (r === null) { + r = 'Error'; + } + return r; }, editor: { xtype: 'combobox', - store: statusStore, + store: statusWerteStore, displayField: 'wert', valueField: 'id', allowBlank: false,