comparison app/controller/grid/Messmethode.js @ 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
comparison
equal deleted inserted replaced
766:31eaed998531 767:5ee59111b188
83 * On success it refreshes the windows which contains the grid 83 * On success it refreshes the windows which contains the grid
84 * On failure it displays a message 84 * On failure it displays a message
85 */ 85 */
86 gridSaveNuklid: function(editor, context) { 86 gridSaveNuklid: function(editor, context) {
87 console.log(context); 87 console.log(context);
88 this.syncArray(context.store); 88 var modified = false;
89 var id = context.newValues.id;
90 var mg = this.record.get('messgroessen');
91
92 //Test if this Nuklid already exists.
93 if (Array.isArray(id)){
94 for (i in id) {
95 //Only insert if value does not exist
96 if (! Ext.Array.contains(mg, id[i])) {
97 modified = true;
98 }
99 }
100 }
101 else {
102 if (! Ext.Array.contains(mg, id)) {
103 mg.push(id);
104 modified = true;
105 }
106 }
107
108 if (modified) {
109 this.syncArray(context.store);
110 }
111 else {
112 editor.getCmp().store.remove(context.record);
113 }
89 }, 114 },
90 115
91 /** 116 /**
92 * When the edit was canceled, 117 * When the edit was canceled,
93 * the empty row might have been created by the roweditor is removed 118 * the empty row might have been created by the roweditor is removed

http://lada.wald.intevation.org