annotate app/view/grid/Probenzusatzwert.js @ 1098:9bfbcad128a3

Set and enforce max text length for stammdaten fields.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 10 May 2016 16:01:25 +0200
parents 7e801af49eeb
children b73f9a976c82
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 Probenzusatzwerte
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.Probenzusatzwert', {
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.probenzusatzwertgrid',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 requires: [
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 'Lada.view.widget.Probenzusatzwert'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 ],
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 maxHeight: 350,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 emptyText: 'Keine Zusatzwerte gefunden.',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 minHeight: 110,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 viewConfig: {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 deferEmptyText: false
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 margin: '0, 5, 5, 5',
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 recordId: null,
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
28 readOnly: true,
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
29 allowDeselect: true,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 initComponent: function() {
571
1dedce48e3e1 Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 559
diff changeset
32 this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 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: 665
diff changeset
34 autoCancel: false,
703
9ab7b1eed9f8 Rowediting is now disabled when the Grid was set to ReadOnly
Dustin Demuth <dustin@intevation.de>
parents: 702
diff changeset
35 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
36 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: 665
diff changeset
37 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: 665
diff changeset
38 // 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: 665
diff changeset
39 // Normally this would belong into a controller an not the view.
702
0c8e689f3bcb Added readonly to models, Probenzusatzwertgrid does now check wheter a record is readonly and disables the roweditor in such a case
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
40 // 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: 665
diff changeset
41 beforeedit: function(e, o) {
702
0c8e689f3bcb Added readonly to models, Probenzusatzwertgrid does now check wheter a record is readonly and disables the roweditor in such a case
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
42 var readonlywin = o.grid.up('window').record.get('readonly');
0c8e689f3bcb Added readonly to models, Probenzusatzwertgrid does now check wheter a record is readonly and disables the roweditor in such a case
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
43 var readonlygrid = o.record.get('readonly');
703
9ab7b1eed9f8 Rowediting is now disabled when the Grid was set to ReadOnly
Dustin Demuth <dustin@intevation.de>
parents: 702
diff changeset
44 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: 665
diff changeset
45 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: 665
diff changeset
46 }
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: 665
diff changeset
47 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: 665
diff changeset
48 }
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: 665
diff changeset
49 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 });
571
1dedce48e3e1 Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 559
diff changeset
51 this.plugins = [this.rowEditing];
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 this.dockedItems = [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 xtype: 'toolbar',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 dock: 'bottom',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 items: ['->', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 text: 'Hinzufügen',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 icon: 'resources/img/list-add.png',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 action: 'add',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 probeId: this.probeId
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 text: 'Löschen',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 icon: 'resources/img/list-remove.png',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 action: 'delete'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 }]
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 this.columns = [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 header: 'PZW-ID',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 dataIndex: 'id',
718
7f11b75e0188 Trailing Commas, editable: false for Umwelt und Messstelle widget
Dustin Demuth <dustin@intevation.de>
parents: 703
diff changeset
69 flex: 1
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 header: 'PZW-Größe',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 dataIndex: 'pzsId',
625
f59bda7551d7 Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents: 571
diff changeset
73 flex: 3,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 renderer: function(value) {
571
1dedce48e3e1 Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 559
diff changeset
75 if (!value || value === '') {
1dedce48e3e1 Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 559
diff changeset
76 return '';
1dedce48e3e1 Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 559
diff changeset
77 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 var store = Ext.data.StoreManager.get('probenzusaetze');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 var record = store.getById(value);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 return record.get('beschreibung');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 editor: {
559
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
83 xtype: 'combobox',
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
84 store: Ext.data.StoreManager.get('probenzusaetze'),
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
85 displayField: 'beschreibung',
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
86 valueField: 'id',
665
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
87 allowBlank: false,
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
88 editable: false
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 header: 'Messwert',
559
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
92 dataIndex: 'messwertPzs',
625
f59bda7551d7 Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents: 571
diff changeset
93 flex: 1,
559
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
94 editor: {
1054
7e801af49eeb Use exponential notation for messwerte and zusatzwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1035
diff changeset
95 xtype: 'textfield',
665
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
96 allowBlank: false,
1054
7e801af49eeb Use exponential notation for messwerte and zusatzwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1035
diff changeset
97 regex: /^[+\-]?(?:(?:0|[1-9]\d*)(?:[\.\,][0-9]\d*)?(?:[eE][+\-]?\d+)|(\d+[\.\,]?\d*)?)$/,
7e801af49eeb Use exponential notation for messwerte and zusatzwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1035
diff changeset
98 regexText: 'Keine Zahl'
665
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
99 }
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
100 }, {
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
101 header: '< NWG',
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
102 flex: 1,
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
103 renderer: function(value, meta, record) {
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
104 var nwg = record.get('nwgZuMesswert');
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
105 var mw = record.get('messwertPzs');
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
106 if ( mw < nwg) {
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
107 return '<';
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
108 }
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
109 return '';
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
110 }
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
111 }, {
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
112 header: 'Nachweisgrenze',
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
113 dataIndex: 'nwgZuMesswert',
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
114 xtype: 'numbercolumn',
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
115 flex: 1,
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
116 editor: {
1054
7e801af49eeb Use exponential notation for messwerte and zusatzwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1035
diff changeset
117 xtype: 'textfield',
665
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
118 allowBlank: false,
1054
7e801af49eeb Use exponential notation for messwerte and zusatzwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1035
diff changeset
119 regex: /^[+\-]?(?:(?:0|[1-9]\d*)(?:[\.\,][0-9]\d*)?(?:[eE][+\-]?\d+)|(\d+[\.\,]?\d*)?)$/,
7e801af49eeb Use exponential notation for messwerte and zusatzwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1035
diff changeset
120 regexText: 'Keine Zahl'
559
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
121 }
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
122 }, {
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
123 header: 'Maßeinheit',
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
124 dataIndex: 'pzsId',
625
f59bda7551d7 Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents: 571
diff changeset
125 flex: 1,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
126 renderer: function(value) {
571
1dedce48e3e1 Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 559
diff changeset
127 if (!value || value === '') {
1dedce48e3e1 Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 559
diff changeset
128 return '';
1dedce48e3e1 Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 559
diff changeset
129 }
559
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
130 var zstore = Ext.data.StoreManager.get('probenzusaetze');
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
131 var mstore = Ext.data.StoreManager.get('messeinheiten');
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
132 var mehId = zstore.getById(value).get('mehId');
723
52c50a5f457b Fixes an Issue that the wrong Units were shown for a Probenzusatzwert. Now the findRecord operation looks for an exact match of the mehId in the Messeinheiten Store
Dustin Demuth <dustin@intevation.de>
parents: 718
diff changeset
133 var record = mstore.findRecord('id', mehId, 0, false, false, true);
559
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
134 return record.get('einheit');
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
135 }
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
136 }, {
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
137 header: 'rel. Unsich.[%]',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
138 dataIndex: 'messfehler',
625
f59bda7551d7 Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents: 571
diff changeset
139 xtype: 'numbercolumn',
f59bda7551d7 Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents: 571
diff changeset
140 format: '0',
f59bda7551d7 Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents: 571
diff changeset
141 flex: 1,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
142 editor: {
625
f59bda7551d7 Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents: 571
diff changeset
143 xtype: 'numberfield',
665
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
144 allowBlank: false,
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
145 maxLength: 3,
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
146 enforceMaxLength: true,
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
147 allowExponential: false,
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
148 allowDecimal: false
625
f59bda7551d7 Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents: 571
diff changeset
149 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
150 }];
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
151 this.listeners = {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
152 select: {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
153 fn: this.activateRemoveButton,
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
154 scope: this
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
155 },
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
156 deselect: {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
157 fn: this.deactivateRemoveButton,
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
158 scope: this
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
159 }
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
160 };
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
161 this.initData();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
162 this.callParent(arguments);
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
163 this.setReadOnly(true); //Grid is always initialised as RO
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
164 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
165
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
166 initData: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
167 this.store = Ext.create('Lada.store.Zusatzwerte');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
168 this.store.load({
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
169 params: {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
170 probeId: this.recordId
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
171 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
172 });
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
173 },
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
174
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
175 setReadOnly: function(b) {
1034
4d4de99bbe53 Get rid of double setting readOnly status of probe window child elements.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 893
diff changeset
176 this.readOnly = b;
4d4de99bbe53 Get rid of double setting readOnly status of probe window child elements.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 893
diff changeset
177 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
178 //Readonly
1035
479782c96efa Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1034
diff changeset
179 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
180 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
181 }
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
182 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
183 this.down('button[action=add]').disable();
1035
479782c96efa Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1034
diff changeset
184 }
479782c96efa Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1034
diff changeset
185 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
186 //Writable
1035
479782c96efa Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1034
diff changeset
187 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
188 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
189 }
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
190 //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
191 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
192 }
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
193 },
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
194 /**
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
195 * Activate the Remove Button
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
196 */
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
197 activateRemoveButton: function(selection, record) {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
198 var grid = this;
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
199 //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: 723
diff changeset
200 if (! grid.readOnly) {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
201 grid.down('button[action=delete]').enable();
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
202 }
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
203 },
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
204 /**
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
205 * Activate the Remove Button
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
206 */
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
207 deactivateRemoveButton: function(selection, record) {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
208 var grid = this;
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
209 //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: 723
diff changeset
210 if (! grid.readOnly) {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
211 grid.down('button[action=delete]').disable();
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
212 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
213 }
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
214
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
215 });

http://lada.wald.intevation.org