[Lada-commits] [PATCH] Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe

Wald Commits scm-commit at wald.intevation.org
Mon Nov 9 13:32:25 CET 2015


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1447072303 -3600
# Node ID 45c67a784b31f02a2b6ffa51f72afd8832674e30
# Parent  b401846e781795171ac57ab7bf2881e7db57e9af
Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe

diff -r b401846e7817 -r 45c67a784b31 app/model/Status.js
--- 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) {
diff -r b401846e7817 -r 45c67a784b31 app/model/StatusStufe.js
--- /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'
+        }
+    }
+
+});
+
diff -r b401846e7817 -r 45c67a784b31 app/model/StatusWerte.js
--- 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',
diff -r b401846e7817 -r 45c67a784b31 app/store/StatusStufe.js
--- /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'
+});
+
diff -r b401846e7817 -r 45c67a784b31 app/view/grid/Status.js
--- 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,


More information about the Lada-commits mailing list