Mercurial > lada > lada-client
annotate app/controller/grid/Status.js @ 945:023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
To enable the uses of StatusWerte, the controller for the status grid, needed to be extended.
In addition, the form and grid views of Messung and Status were updated.
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Tue, 27 Oct 2015 16:46:58 +0100 |
parents | 1f1467713c3f |
children | 5b86baa038bc |
rev | line source |
---|---|
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 * |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 */ |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
9 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
10 * This is a controller for a grid of Status |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
11 */ |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 Ext.define('Lada.controller.grid.Status', { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 extend: 'Ext.app.Controller', |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
15 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
16 * Initialize the Controller with |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
17 * 3 Listeners |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
18 */ |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
19 init: function() { |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 this.control({ |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 'statusgrid': { |
637
8acb3123b46c
Remove a new record on cancel in grids with rowediting plugin.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
594
diff
changeset
|
22 edit: this.gridSave, |
945
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
23 canceledit: this.cancelEdit, |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
24 select: this.toggleAllowedPermissions |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 }, |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 'statusgrid button[action=add]': { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 click: this.add |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 }, |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 'statusgrid button[action=delete]': { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 click: this.remove |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 } |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 }); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 }, |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
35 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
36 * This function is called when the grids roweditor saves |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
37 * the record. |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
38 * On success it refreshes the windows which contains the grid |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
39 * On failure it displays a message |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
40 */ |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
41 gridSave: function(editor, context) { |
944 | 42 context.record.set('sdatum', new Date()); |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 context.record.save({ |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 success: function() { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 context.grid.initData(); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 context.grid.up('window').initData(); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 }, |
701
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
48 failure: function(request, response) { |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
49 var json = response.request.scope.reader.jsonData; |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
50 if (json) { |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
51 if (json.message){ |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
52 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title') |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
53 +' #'+json.message, |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
54 Lada.getApplication().bundle.getMsg(json.message)); |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
55 } else { |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
56 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'), |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
57 Lada.getApplication().bundle.getMsg('err.msg.generic.body')); |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
58 } |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
59 } else { |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
60 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'), |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
61 Lada.getApplication().bundle.getMsg('err.msg.response.body')); |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
62 } |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 } |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 }); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 }, |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
67 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
68 * When the edit was canceled, |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
69 * the empty row might have been created by the roweditor is removed |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
70 */ |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
71 cancelEdit: function(editor, context) { |
637
8acb3123b46c
Remove a new record on cancel in grids with rowediting plugin.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
594
diff
changeset
|
72 if (!context.record.get('id') || |
8acb3123b46c
Remove a new record on cancel in grids with rowediting plugin.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
594
diff
changeset
|
73 context.record.get('id') === '') { |
8acb3123b46c
Remove a new record on cancel in grids with rowediting plugin.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
594
diff
changeset
|
74 editor.getCmp().store.remove(context.record); |
8acb3123b46c
Remove a new record on cancel in grids with rowediting plugin.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
594
diff
changeset
|
75 } |
8acb3123b46c
Remove a new record on cancel in grids with rowediting plugin.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
594
diff
changeset
|
76 }, |
8acb3123b46c
Remove a new record on cancel in grids with rowediting plugin.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
594
diff
changeset
|
77 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
78 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
79 * This function adds a new row to add a Status |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
80 */ |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
81 add: function(button) { |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
82 var record = Ext.create('Lada.model.Status', { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
83 messungsId: button.up('statusgrid').recordId |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 }); |
945
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
85 var lastrow = button.up('statusgrid').store.count() |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
86 button.up('statusgrid').store.insert(lastrow, record); |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
87 button.up('statusgrid').rowEditing.startEdit(lastrow, 1); |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 }, |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
90 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
91 * A row can be removed from the grid with the remove |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
92 * function. It asks the user for confirmation |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
93 * If the removal was confirmed, it reloads the parent window on success, |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
94 * on failure, an error message is shown. |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
95 */ |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
96 remove: function(button) { |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 var grid = button.up('grid'); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 var selection = grid.getView().getSelectionModel().getSelection()[0]; |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
99 Ext.MessageBox.confirm('Messwert löschen', 'Sind Sie sicher?', function(btn) { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
100 if (btn === 'yes') { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
101 selection.destroy({ |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
102 success: function() { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 button.up('window').initData(); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
104 grid.initData(); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
105 }, |
701
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
106 failure: function(request, response) { |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
107 var json = response.request.scope.reader.jsonData; |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
108 if (json) { |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
109 if (json.message){ |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
110 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title') |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
111 +' #'+json.message, |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
112 Lada.getApplication().bundle.getMsg(json.message)); |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
113 } else { |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
114 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'), |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
115 Lada.getApplication().bundle.getMsg('err.msg.generic.body')); |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
116 } |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
117 } else { |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
118 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'), |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
119 Lada.getApplication().bundle.getMsg('err.msg.response.body')); |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
637
diff
changeset
|
120 } |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
121 } |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
122 }); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
123 } |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
124 }); |
826
2362f8ab1e9f
disable remove button after a item is deleted from grid
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
125 grid.down('button[action=delete]').disable(); |
945
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
126 }, |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
127 |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
128 /** |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
129 * When a row in a grid is selected, |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
130 * this function checks if the row may be edited, |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
131 * or if the row can be removed |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
132 */ |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
133 toggleAllowedPermissions: function(context, record, index){ |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
134 |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
135 //retrieve the readOnly parameters |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
136 var readonlyWin = context.view.up('window').record.get('readonly'); |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
137 |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
138 var readonlyRec = record.get('readonly'); |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
139 var grid = context.view.up('grid'); |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
140 |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
141 //retrieve the last record of the store |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
142 var lastRecord = context.getStore().last() |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
143 //Check if remove is allowed |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
144 if (lastRecord == record && |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
145 readonlyWin == false && |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
146 readonlyRec == false) { |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
147 grid.down('button[action=delete]').enable(); |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
148 } |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
149 else { |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
150 grid.down('button[action=delete]').disable(); |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
151 } |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
152 |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
153 |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
154 //Check if edit is allowed |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
155 if (lastRecord == record && |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
156 readonlyWin == false && |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
157 readonlyRec == false) { |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
158 grid.getPlugin('rowedit').enable() |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
159 } |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
160 else { |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
161 grid.getPlugin('rowedit').disable() |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
162 } |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
163 } |
945
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
944
diff
changeset
|
164 |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
165 }); |