annotate app/view/grid/Messung.js @ 856:e44070aa45d2

Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
author Dustin Demuth <dustin@intevation.de>
date Fri, 10 Jul 2015 17:14:19 +0200
parents 5ed0e6273888
children 07dfcdf5b41f
rev   line source
588
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 /*
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 * Grid to list Messungen
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 */
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.grid.Messung', {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Ext.grid.Panel',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 alias: 'widget.messunggrid',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 maxHeight: 350,
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 emptyText: 'Keine Messungen gefunden',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 minHeight: 110,
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 viewConfig: {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 deferEmptyText: false
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 },
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 margin: '0, 5, 5, 5',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 recordId: null,
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 warnings: null,
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 errors: null,
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
28 readOnly: true,
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
29 allowDeselect: true,
588
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 initComponent: function() {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 this.dockedItems = [{
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 xtype: 'toolbar',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 dock: 'bottom',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 items: ['->', {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 text: 'Hinzufügen',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 icon: 'resources/img/list-add.png',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 action: 'add',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 probeId: this.probeId
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 }, {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 text: 'Löschen',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 icon: 'resources/img/list-remove.png',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 action: 'delete'
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 }]
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 }];
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 this.columns = [{
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 header: 'Mess-ID',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 dataIndex: 'id',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 flex: 1,
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 editor: {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 allowBlank: false
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 }
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 }, {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 header: 'Nebenproben-Nr.',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 dataIndex: 'nebenprobenNr',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 flex: 1,
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 editor: {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 allowBlank: false
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 }
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 }, {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 header: 'MMT',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 dataIndex: 'mmtId',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 flex: 1,
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 editor: {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 allowBlank: false
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 }
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 }, {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 header: 'Messzeit',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 dataIndex: 'messzeitpunkt',
627
6742ae5f35dc Datumsspalte xtype hinzugefügt
Dustin Demuth <dustin@intevation.de>
parents: 588
diff changeset
70 xtype: 'datecolumn',
6742ae5f35dc Datumsspalte xtype hinzugefügt
Dustin Demuth <dustin@intevation.de>
parents: 588
diff changeset
71 format: 'd.m.Y H:i',
588
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 flex: 2,
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 editor: {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 xtype: 'datefield',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 allowBlank: false,
627
6742ae5f35dc Datumsspalte xtype hinzugefügt
Dustin Demuth <dustin@intevation.de>
parents: 588
diff changeset
76 format: 'd.m.Y H:i',
588
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 // minValue: '01.01.2001', //todo: gibt es das?
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 // minText: 'Das Datum der Messung darf nicht vor dem 01.01.2001 liegen.',
627
6742ae5f35dc Datumsspalte xtype hinzugefügt
Dustin Demuth <dustin@intevation.de>
parents: 588
diff changeset
79 maxValue: Ext.Date.format(new Date(), 'd.m.Y H:i')
588
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 }
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 }, {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 header: 'Status',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 flex: 1,
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 dataIndex: 'id',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 renderer: function(value) {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 var id = 'messung-status-item' + value;
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 this.updateStatus(value, id);
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 return '<div id="' + id + '">Lade...</div>';
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 }
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 }, {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 header: 'OK-Flag',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 dataIndex: 'fertig',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93 flex: 1,
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 renderer: function(value) {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 if (value) {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 return 'Ja';
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 }
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 return 'Nein';
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 },
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 editor: {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 xtype: 'checkboxfield',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102 allowBlank: false
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
103 }
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 }, {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105 header: 'Anzahl Nuklide',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 // Gibt die Anzahl der Messwerte wieder,
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107 // NICHT die Anzahl der verschiedenen Nukleide
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
108 // Eventuell ist die Bezeichnug daher irreführend
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
109 dataIndex: 'id',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
110 flex: 1,
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
111 renderer: function(value) {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
112 var id = 'messung-nuklid-item' + value;
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113 this.updateNuklide(value, id);
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114 return '<div id="' + id + '">Lade...</div>';
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
115 }
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
116 }, {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
117 header: 'Anzahl Kommentare',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
118 flex: 1,
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119 dataIndex: 'id',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 renderer: function(value) {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
121 var id = 'messung-kommentar-item' + value;
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
122 this.updateKommentare(value, id);
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
123 return '<div id="' + id + '">Lade...</div>';
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
124 }
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
125 }];
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
126 this.listeners = {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
127 select: {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
128 fn: this.activateRemoveButton,
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
129 scope: this
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
130 },
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
131 deselect: {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
132 fn: this.deactivateRemoveButton,
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
133 scope: this
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
134 }
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
135 };
588
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
136 this.initData();
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
137 this.callParent(arguments);
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
138 this.setReadOnly(true); //Grid is always initialised as RO
588
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
139 },
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
140
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
141 initData: function() {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
142 this.store = Ext.create('Lada.store.Messungen');
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
143 this.store.load({
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
144 params: {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145 probeId: this.recordId
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
146 }
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
147 });
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
148 },
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
149
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
150 updateStatus: function(value, divId) {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151 var statusStore = Ext.create('Lada.store.Status');
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
152 statusStore.on('load',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
153 this.updateStatusColumn,
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
154 this,
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
155 {divId: divId});
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
156 statusStore.load({
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
157 params: {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
158 messungsId: value
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
159 }
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
160 });
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
161 },
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
162
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
163 updateNuklide: function(value, divId) {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
164 var messwerte = Ext.create('Lada.store.Messwerte');
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
165 messwerte.on('load',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
166 this.updateColumn,
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
167 this,
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
168 {divId: divId});
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
169 messwerte.load({
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
170 params: {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
171 messungsId: value
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
172 }
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
173 });
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
174 },
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
175
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
176 updateKommentare: function(value, divId) {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
177 var kommentare = Ext.create('Lada.store.MKommentare');
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
178 kommentare.on('load',
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
179 this.updateColumn,
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
180 this,
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
181 {divId: divId});
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
182 kommentare.load({
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
183 params: {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
184 messungsId: value
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
185 }
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
186 });
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
187 },
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
188
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
189 updateColumn: function(store, record, success, opts) {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
190 var value;
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
191 if (store.getTotalCount() === 0) {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
192 value = 'Keine';
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
193 }
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
194 else {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
195 value = store.getTotalCount();
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
196 }
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
197 Ext.fly(opts.divId).update(value);
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
198 },
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
199
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
200 updateStatusColumn: function(sstore, record, success, opts) {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
201 var value;
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
202 if (sstore.getTotalCount() === 0) {
813
ee8cce4b4522 In some cases there was an error bc. the Item in the StatuswerteStore was not found. this is fixed now.
Dustin Demuth <dustin@intevation.de>
parents: 799
diff changeset
203 value = 0;
588
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
204 }
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
205 else {
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
206 value = sstore.last().get('status');
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
207 }
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
208 if (Ext.fly(opts.divId)) {
799
ad24af3fcf89 created StatusWerte Store to correctly display textual representation of a Status in a MessungenGrid
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
209 var sta = Ext.create('Lada.store.StatusWerte');
ad24af3fcf89 created StatusWerte Store to correctly display textual representation of a Status in a MessungenGrid
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
210 var val = sta.getById(value).get('display');
ad24af3fcf89 created StatusWerte Store to correctly display textual representation of a Status in a MessungenGrid
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
211 Ext.fly(opts.divId).update(val);
588
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
212 }
684
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 627
diff changeset
213 },
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 627
diff changeset
214
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 627
diff changeset
215 setReadOnly: function(b) {
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 627
diff changeset
216 if (b == true){
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 627
diff changeset
217 //Readonly
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 627
diff changeset
218 if (this.getPlugin('rowedit')){
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 627
diff changeset
219 this.getPlugin('rowedit').disable();
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 627
diff changeset
220 }
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 627
diff changeset
221 this.down('button[action=delete]').disable();
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 627
diff changeset
222 this.down('button[action=add]').disable();
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 627
diff changeset
223 }else{
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 627
diff changeset
224 //Writable
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 627
diff changeset
225 if (this.getPlugin('rowedit')){
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 627
diff changeset
226 this.getPlugin('rowedit').enable();
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 627
diff changeset
227 }
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
228 //this.down('button[action=delete]').enable();
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
229 //always disabled, unless a row was selected
684
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 627
diff changeset
230 this.down('button[action=add]').enable();
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 627
diff changeset
231 }
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
232 },
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
233 /**
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
234 * Activate the Remove Button
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
235 */
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
236 activateRemoveButton: function(selection, record) {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
237 var grid = this;
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
238 //only enable the remove buttone, when the grid is editable.
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
239 if (! grid.readOnly) {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
240 grid.down('button[action=delete]').enable();
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
241 }
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
242 },
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
243 /**
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
244 * Activate the Remove Button
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
245 */
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
246 deactivateRemoveButton: function(selection, record) {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
247 var grid = this;
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
248 //only enable the remove buttone, when the grid is editable.
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
249 if (! grid.readOnly) {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
250 grid.down('button[action=delete]').disable();
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 813
diff changeset
251 }
588
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
252 }
e24bc8cf8e1d Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
253 });

http://lada.wald.intevation.org