changeset 767:5ee59111b188

Add/Remove is now reliable
author Dustin Demuth <dustin@intevation.de>
date Tue, 12 May 2015 14:53:54 +0200
parents 31eaed998531
children 380edfecac67
files app/controller/grid/Messmethode.js app/view/grid/Messmethoden.js app/view/grid/Nuklide.js
diffstat 3 files changed, 34 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/grid/Messmethode.js	Tue May 12 14:24:41 2015 +0200
+++ b/app/controller/grid/Messmethode.js	Tue May 12 14:53:54 2015 +0200
@@ -85,7 +85,32 @@
      */
     gridSaveNuklid: function(editor, context) {
         console.log(context);
-        this.syncArray(context.store);
+        var modified = false;
+        var id = context.newValues.id;
+        var mg = this.record.get('messgroessen');
+
+        //Test if this Nuklid already exists.
+        if (Array.isArray(id)){
+            for (i in id) {
+                //Only insert if value does not exist
+                if (! Ext.Array.contains(mg, id[i])) {
+                    modified = true;
+                }
+            }
+        }
+        else {
+            if (! Ext.Array.contains(mg, id)) {
+                mg.push(id);
+                modified = true;
+            }
+        }
+
+        if (modified) {
+            this.syncArray(context.store);
+        }
+        else {
+            editor.getCmp().store.remove(context.record);
+        }
     },
 
     /**
--- a/app/view/grid/Messmethoden.js	Tue May 12 14:24:41 2015 +0200
+++ b/app/view/grid/Messmethoden.js	Tue May 12 14:53:54 2015 +0200
@@ -17,12 +17,12 @@
         'Lada.view.widget.Messmethode'
     ],
 
-    maxHeight: 350,
-    minHeight: 110,
+    maxHeight: 150,
+    minHeight: 150,
     viewConfig: {
         deferEmptyText: false
     },
-    margin: '0, 5, 5, 5',
+    //margin: '0, 0, 5, 5',
 
     recordId: null,
 
--- a/app/view/grid/Nuklide.js	Tue May 12 14:24:41 2015 +0200
+++ b/app/view/grid/Nuklide.js	Tue May 12 14:53:54 2015 +0200
@@ -17,12 +17,13 @@
         'Lada.view.widget.Messgroesse'
     ],
 
-    maxHeight: 350,
-    minHeight: 110,
+    maxHeight: 150,
+    minHeight: 150,
     viewConfig: {
-        deferEmptyText: false
+        deferEmptyText: false,
+        markDirty: false //Remove Dirty-Flags
     },
-    margin: '0, 5, 5, 5',
+    //margin: '0, 0, 5, 5',
 
     recordId: null,
 

http://lada.wald.intevation.org