comparison app/controller/grid/Probenehmer.js @ 1078:fe5fb960da9d

Handle edit and delete status for stammdaten objects.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 13 Apr 2016 13:55:39 +0200
parents e79403c3482e
children 5e9a674d7bb4
comparison
equal deleted inserted replaced
1077:2a5d42045c63 1078:fe5fb960da9d
19 init: function() { 19 init: function() {
20 this.control({ 20 this.control({
21 'probenehmergrid': { 21 'probenehmergrid': {
22 edit: this.gridSave, 22 edit: this.gridSave,
23 canceledit: this.cancelEdit, 23 canceledit: this.cancelEdit,
24 select: this.buttonToggle, 24 select: this.select,
25 deselect: this.buttonToggle, 25 deselect: this.buttonToggle,
26 itemdblclick: this.edit 26 itemdblclick: this.edit
27 }, 27 },
28 'probenehmergrid button[action=add]': { 28 'probenehmergrid button[action=add]': {
29 click: this.add 29 click: this.add
32 click: this.remove 32 click: this.remove
33 } 33 }
34 }); 34 });
35 }, 35 },
36 36
37 edit: function() { 37 select: function(rowModel, record) {
38 this.checkEdit(rowModel, record);
39 this.buttonToggle(rowModel, record);
40 },
41
42 checkEdit: function(rowModel, record) {
43 if (!Ext.Array.contains(Lada.netzbetreiber,
44 record.get('netzbetreiberId'))) {
45 var grid = Ext.ComponentQuery.query('probenehmergrid')[0];
46 grid.rowEditing.cancelEdit();
47 return;
48 }
49 },
50
51 edit: function (gridView, record) {
38 var grid = Ext.ComponentQuery.query('probenehmergrid')[0]; 52 var grid = Ext.ComponentQuery.query('probenehmergrid')[0];
53 if (!Ext.Array.contains(Lada.netzbetreiber,
54 record.get('netzbetreiberId'))) {
55 grid.rowEditing.cancelEdit();
56 return;
57 }
39 grid.down('button[action=delete]').disable(); 58 grid.down('button[action=delete]').disable();
40 }, 59 },
41 60
42 /** 61 /**
43 * This function is called when the grids roweditor saves 62 * This function is called when the grids roweditor saves
141 buttonToggle: function(rowModel, record) { 160 buttonToggle: function(rowModel, record) {
142 if (!Ext.Array.contains(Lada.funktionen, 4)) { 161 if (!Ext.Array.contains(Lada.funktionen, 4)) {
143 return; 162 return;
144 } 163 }
145 var grid = Ext.ComponentQuery.query('probenehmergrid')[0]; 164 var grid = Ext.ComponentQuery.query('probenehmergrid')[0];
146 if (!record) { 165 if (!record ||
166 !Ext.Array.contains(Lada.netzbetreiber,
167 record.get('netzbetreiberId'))) {
147 grid.down('button[action=delete]').disable(); 168 grid.down('button[action=delete]').disable();
148 return; 169 return;
149 } 170 }
150 if (record.get('readonly') || 171 if (record.get('readonly') ||
151 rowModel.selected.items.length === 0) { 172 rowModel.selected.items.length === 0) {

http://lada.wald.intevation.org