annotate app/view/grid/PKommentar.js @ 1198:3b6f40541ac6

Remove wrong period check. The validity period can be e.g. from November till February, thus spanning over turn of the year and allowing a from value greater than to value (in terms of day of year).
author Tom Gottfried <tom@intevation.de>
date Fri, 23 Sep 2016 16:32:30 +0200
parents 479782c96efa
children 6d06ae7c553c
rev   line source
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
893
07dfcdf5b41f jsduck for grids and panels
Dustin Demuth <dustin@intevation.de>
parents: 824
diff changeset
9 /**
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 * Grid to list Kommentare
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 */
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.grid.PKommentar', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Ext.grid.Panel',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 alias: 'widget.pkommentargrid',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 requires: [
572
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
17 'Ext.toolbar.Toolbar',
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
18 'Lada.store.PKommentare'
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 ],
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 maxHeight: 350,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 emptyText: 'Keine Kommentaregefunden.',
572
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
23 minHeight: 110,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 viewConfig: {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 deferEmptyText: false
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 recordId: null,
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
29 readOnly: true,
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
30 allowDeselect: true,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 initComponent: function() {
572
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
33 this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 clicksToMoveEditor: 1,
683
612f4f933083 Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
Dustin Demuth <dustin@intevation.de>
parents: 572
diff changeset
35 autoCancel: false,
703
9ab7b1eed9f8 Rowediting is now disabled when the Grid was set to ReadOnly
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
36 disabled: false,
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: 683
diff changeset
37 pluginId: 'rowedit',
683
612f4f933083 Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
Dustin Demuth <dustin@intevation.de>
parents: 572
diff changeset
38 listeners:{
612f4f933083 Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
Dustin Demuth <dustin@intevation.de>
parents: 572
diff changeset
39 // Make row ineditable when readonly is set to true
612f4f933083 Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
Dustin Demuth <dustin@intevation.de>
parents: 572
diff changeset
40 // Normally this would belong into a controller an not the view.
703
9ab7b1eed9f8 Rowediting is now disabled when the Grid was set to ReadOnly
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
41 // But the RowEditPlugin is not handled there.
683
612f4f933083 Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
Dustin Demuth <dustin@intevation.de>
parents: 572
diff changeset
42 beforeedit: function(e, o) {
703
9ab7b1eed9f8 Rowediting is now disabled when the Grid was set to ReadOnly
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
43 var readonlywin = o.grid.up('window').record.get('readonly');
9ab7b1eed9f8 Rowediting is now disabled when the Grid was set to ReadOnly
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
44 var readonlygrid = o.record.get('readonly');
9ab7b1eed9f8 Rowediting is now disabled when the Grid was set to ReadOnly
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
45 if (readonlywin == true || readonlygrid == true || this.disabled) {
683
612f4f933083 Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
Dustin Demuth <dustin@intevation.de>
parents: 572
diff changeset
46 return false;
612f4f933083 Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
Dustin Demuth <dustin@intevation.de>
parents: 572
diff changeset
47 }
612f4f933083 Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
Dustin Demuth <dustin@intevation.de>
parents: 572
diff changeset
48 return true;
612f4f933083 Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
Dustin Demuth <dustin@intevation.de>
parents: 572
diff changeset
49 }
612f4f933083 Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
Dustin Demuth <dustin@intevation.de>
parents: 572
diff changeset
50 }
703
9ab7b1eed9f8 Rowediting is now disabled when the Grid was set to ReadOnly
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
51 });
572
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
52 this.plugins = [this.rowEditing];
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 this.dockedItems = [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 xtype: 'toolbar',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 dock: 'bottom',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 items: ['->', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 text: 'Hinzufügen',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 icon: 'resources/img/list-add.png',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 action: 'add',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 probeId: this.probeId
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 text: 'Löschen',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 icon: 'resources/img/list-remove.png',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 action: 'delete'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 }]
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 }];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 this.columns = [{
943
0a233865a9c3 PKommentar an MKommentar grid modified
Michael Stanko <mstanko@bfs.de>
parents: 893
diff changeset
68 header: 'erstellt',
0a233865a9c3 PKommentar an MKommentar grid modified
Michael Stanko <mstanko@bfs.de>
parents: 893
diff changeset
69 dataIndex: 'datum',
0a233865a9c3 PKommentar an MKommentar grid modified
Michael Stanko <mstanko@bfs.de>
parents: 893
diff changeset
70 xtype: 'datecolumn',
0a233865a9c3 PKommentar an MKommentar grid modified
Michael Stanko <mstanko@bfs.de>
parents: 893
diff changeset
71 format: 'd.m.Y H:i',
966
6e67eb947258 Removed trailing commas
Dustin Demuth <dustin@intevation.de>
parents: 959
diff changeset
72 width: 110
943
0a233865a9c3 PKommentar an MKommentar grid modified
Michael Stanko <mstanko@bfs.de>
parents: 893
diff changeset
73 }, {
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 header: 'Erzeuger',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 dataIndex: 'erzeuger',
572
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
76 width: 140,
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
77 renderer: function(value) {
959
841196768e86 Made kommentare-grids more robust
Dustin Demuth <dustin@intevation.de>
parents: 943
diff changeset
78 var r = '';
572
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
79 if (!value || value === '') {
959
841196768e86 Made kommentare-grids more robust
Dustin Demuth <dustin@intevation.de>
parents: 943
diff changeset
80 r = 'Error';
572
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
81 }
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
82 var store = Ext.data.StoreManager.get('messstellen');
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
83 var record = store.getById(value);
959
841196768e86 Made kommentare-grids more robust
Dustin Demuth <dustin@intevation.de>
parents: 943
diff changeset
84 if (record) {
841196768e86 Made kommentare-grids more robust
Dustin Demuth <dustin@intevation.de>
parents: 943
diff changeset
85 r = record.get('messStelle');
841196768e86 Made kommentare-grids more robust
Dustin Demuth <dustin@intevation.de>
parents: 943
diff changeset
86 }
841196768e86 Made kommentare-grids more robust
Dustin Demuth <dustin@intevation.de>
parents: 943
diff changeset
87 return r;
572
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
88 },
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 editor: {
572
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
90 xtype: 'combobox',
971
37f30b01788c Uses a filtered store for the messtellen in PKommentare and MKommentare grids. This narrows down the list of selectable messstellen to those the user is currently associtated to
Dustin Demuth <dustin@intevation.de>
parents: 966
diff changeset
91 store: Ext.data.StoreManager.get('messstellenFiltered'),
572
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
92 displayField: 'messStelle',
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
93 valueField: 'id',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 allowBlank: false
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 header: 'Text',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 dataIndex: 'text',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 flex: 1,
572
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
100 renderer: function(value) {
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
101 return '<div style="white-space: normal !important;">' +
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
102 value + '</div>';
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
103 },
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 editor: {
572
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
105 xtype: 'textarea',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 allowBlank: false
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
108 }];
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
109 this.listeners = {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
110 select: {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
111 fn: this.activateRemoveButton,
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
112 scope: this
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
113 },
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
114 deselect: {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
115 fn: this.deactivateRemoveButton,
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
116 scope: this
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
117 }
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
118 };
572
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
119 this.initData();
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 this.callParent(arguments);
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
121 this.setReadOnly(true); //Grid is always initialised as RO
572
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
122 },
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
123
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
124 initData: function() {
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
125 this.store = Ext.create('Lada.store.PKommentare');
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
126 this.store.load({
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
127 params: {
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
128 probeId: this.recordId
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
129 }
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
130 });
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: 683
diff changeset
131 },
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: 683
diff changeset
132
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: 683
diff changeset
133 setReadOnly: function(b) {
1034
4d4de99bbe53 Get rid of double setting readOnly status of probe window child elements.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 971
diff changeset
134 this.readOnly = b;
4d4de99bbe53 Get rid of double setting readOnly status of probe window child elements.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 971
diff changeset
135 if (b) {
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: 683
diff changeset
136 //Readonly
1035
479782c96efa Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1034
diff changeset
137 if (this.getPlugin('rowedit')) {
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: 683
diff changeset
138 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: 683
diff changeset
139 }
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: 683
diff changeset
140 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: 683
diff changeset
141 this.down('button[action=add]').disable();
1035
479782c96efa Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1034
diff changeset
142 }
479782c96efa Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1034
diff changeset
143 else {
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: 683
diff changeset
144 //Writable
1035
479782c96efa Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1034
diff changeset
145 if (this.getPlugin('rowedit')) {
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: 683
diff changeset
146 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: 683
diff changeset
147 }
824
fab0b7be5aca add disbled remove button to all grids which relate to proben or messungen. Messprogramme-grids are untouched. BUG: When the last entry is deleted, the button remains active
Dustin Demuth <dustin@intevation.de>
parents: 823
diff changeset
148 //this.down('button[action=delete]').enable();
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: 683
diff changeset
149 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: 683
diff changeset
150 }
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
151 },
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
152 /**
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
153 * Activate the Remove Button
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
154 */
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
155 activateRemoveButton: function(selection, record) {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
156 var grid = this;
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
157 //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: 703
diff changeset
158 if (! grid.readOnly) {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
159 grid.down('button[action=delete]').enable();
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
160 }
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
161 },
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
162 /**
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
163 * Activate the Remove Button
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
164 */
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
165 deactivateRemoveButton: function(selection, record) {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
166 var grid = this;
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
167 //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: 703
diff changeset
168 if (! grid.readOnly) {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
169 grid.down('button[action=delete]').disable();
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
170 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
171 }
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
172
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
173 });

http://lada.wald.intevation.org