Mercurial > lada > lada-client
comparison app/controller/grid/Datensatzerzeuger.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 | fa422d69940c |
children | 1c86a259c2ac |
comparison
equal
deleted
inserted
replaced
1077:2a5d42045c63 | 1078:fe5fb960da9d |
---|---|
19 init: function() { | 19 init: function() { |
20 this.control({ | 20 this.control({ |
21 'datensatzerzeugergrid': { | 21 'datensatzerzeugergrid': { |
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 'datensatzerzeugergrid button[action=add]': { | 28 'datensatzerzeugergrid 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 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('datensatzerzeugergrid')[0]; | |
46 grid.rowEditing.cancelEdit(); | |
47 return; | |
48 } | |
49 }, | |
50 | |
37 edit: function() { | 51 edit: function() { |
38 var grid = Ext.ComponentQuery.query('datensatzerzeugergrid')[0]; | 52 var grid = Ext.ComponentQuery.query('datensatzerzeugergrid')[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 |
138 buttonToggle: function(rowModel, record) { | 157 buttonToggle: function(rowModel, record) { |
139 if (!Ext.Array.contains(Lada.funktionen, 4)) { | 158 if (!Ext.Array.contains(Lada.funktionen, 4)) { |
140 return; | 159 return; |
141 } | 160 } |
142 var grid = Ext.ComponentQuery.query('datensatzerzeugergrid')[0]; | 161 var grid = Ext.ComponentQuery.query('datensatzerzeugergrid')[0]; |
143 if (!record) { | 162 if (!record || |
163 !Ext.Array.contains(Lada.netzbetreiber, | |
164 record.get('netzbetreiberId'))) { | |
144 grid.down('button[action=delete]').disable(); | 165 grid.down('button[action=delete]').disable(); |
145 return; | 166 return; |
146 } | 167 } |
147 if (record.get('readonly') || | 168 if (record.get('readonly') || |
148 rowModel.selected.items.length === 0) { | 169 rowModel.selected.items.length === 0) { |