Mercurial > lada > lada-client
annotate app/view/grid/Probenzusatzwert.js @ 1124:a4944b52176e
Fixed selecting item on undefined attribute.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Tue, 24 May 2016 10:39:43 +0200 |
parents | b73f9a976c82 |
children | 4f68511ce7a4 |
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: [ |
1119
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
16 'Lada.view.form.ExpNumberField', |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 'Lada.view.widget.Probenzusatzwert' |
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 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 maxHeight: 350, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 emptyText: 'Keine Zusatzwerte gefunden.', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 minHeight: 110, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 viewConfig: { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 deferEmptyText: false |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 margin: '0, 5, 5, 5', |
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:
723
diff
changeset
|
29 readOnly: true, |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
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() { |
571
1dedce48e3e1
Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
559
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:
665
diff
changeset
|
35 autoCancel: false, |
703
9ab7b1eed9f8
Rowediting is now disabled when the Grid was set to ReadOnly
Dustin Demuth <dustin@intevation.de>
parents:
702
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:
665
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:
665
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:
665
diff
changeset
|
40 // 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
|
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:
665
diff
changeset
|
42 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
|
43 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
|
44 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
|
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:
665
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:
665
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:
665
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:
665
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:
665
diff
changeset
|
50 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 }); |
571
1dedce48e3e1
Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
559
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 = [{ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 header: 'PZW-ID', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 dataIndex: 'id', |
718
7f11b75e0188
Trailing Commas, editable: false for Umwelt und Messstelle widget
Dustin Demuth <dustin@intevation.de>
parents:
703
diff
changeset
|
70 flex: 1 |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 }, { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 header: 'PZW-Größe', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 dataIndex: 'pzsId', |
625
f59bda7551d7
Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents:
571
diff
changeset
|
74 flex: 3, |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 renderer: function(value) { |
571
1dedce48e3e1
Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
559
diff
changeset
|
76 if (!value || value === '') { |
1dedce48e3e1
Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
559
diff
changeset
|
77 return ''; |
1dedce48e3e1
Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
559
diff
changeset
|
78 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 var store = Ext.data.StoreManager.get('probenzusaetze'); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 var record = store.getById(value); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
81 return record.get('beschreibung'); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
82 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
83 editor: { |
559
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
84 xtype: 'combobox', |
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
85 store: Ext.data.StoreManager.get('probenzusaetze'), |
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
86 displayField: 'beschreibung', |
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
87 valueField: 'id', |
665
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
88 allowBlank: false, |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
89 editable: false |
548
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 }, { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
92 header: 'Messwert', |
559
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
93 dataIndex: 'messwertPzs', |
625
f59bda7551d7
Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents:
571
diff
changeset
|
94 flex: 1, |
559
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
95 editor: { |
1119
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
96 xtype: 'expnumberfield', |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
97 }, |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
98 renderer: function(value) { |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
99 if (!value || value === '') { |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
100 return value; |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
101 } |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
102 return value.toExponential(2).toString().replace('.', ','); |
665
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
103 } |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
104 }, { |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
105 header: '< NWG', |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
106 flex: 1, |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
107 renderer: function(value, meta, record) { |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
108 var nwg = record.get('nwgZuMesswert'); |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
109 var mw = record.get('messwertPzs'); |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
110 if ( mw < nwg) { |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
111 return '<'; |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
112 } |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
113 return ''; |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
114 } |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
115 }, { |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
116 header: 'Nachweisgrenze', |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
117 dataIndex: 'nwgZuMesswert', |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
118 xtype: 'numbercolumn', |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
119 flex: 1, |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
120 editor: { |
1119
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
121 xtype: 'expnumberfield', |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
122 }, |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
123 renderer: function(value) { |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
124 if (!value || value === '') { |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
125 return value; |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
126 } |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
127 return value.toExponential(2).toString().replace('.', ','); |
559
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
128 } |
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
129 }, { |
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
130 header: 'Maßeinheit', |
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
131 dataIndex: 'pzsId', |
625
f59bda7551d7
Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents:
571
diff
changeset
|
132 flex: 1, |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
133 renderer: function(value) { |
571
1dedce48e3e1
Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
559
diff
changeset
|
134 if (!value || value === '') { |
1dedce48e3e1
Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
559
diff
changeset
|
135 return ''; |
1dedce48e3e1
Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
559
diff
changeset
|
136 } |
559
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
137 var zstore = Ext.data.StoreManager.get('probenzusaetze'); |
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
138 var mstore = Ext.data.StoreManager.get('messeinheiten'); |
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
139 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
|
140 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
|
141 return record.get('einheit'); |
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
142 } |
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
143 }, { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
144 header: 'rel. Unsich.[%]', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
145 dataIndex: 'messfehler', |
625
f59bda7551d7
Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents:
571
diff
changeset
|
146 xtype: 'numbercolumn', |
f59bda7551d7
Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents:
571
diff
changeset
|
147 format: '0', |
f59bda7551d7
Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents:
571
diff
changeset
|
148 flex: 1, |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
149 editor: { |
625
f59bda7551d7
Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents:
571
diff
changeset
|
150 xtype: 'numberfield', |
665
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
151 allowBlank: false, |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
152 maxLength: 3, |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
153 enforceMaxLength: true, |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
154 allowExponential: false, |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
155 allowDecimal: false |
625
f59bda7551d7
Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents:
571
diff
changeset
|
156 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
157 }]; |
823
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
158 this.listeners = { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
159 select: { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
160 fn: this.activateRemoveButton, |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
161 scope: this |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
162 }, |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
163 deselect: { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
164 fn: this.deactivateRemoveButton, |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
165 scope: this |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
166 } |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
167 }; |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
168 this.initData(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
169 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
|
170 this.setReadOnly(true); //Grid is always initialised as RO |
548
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 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
173 initData: function() { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
174 this.store = Ext.create('Lada.store.Zusatzwerte'); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
175 this.store.load({ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
176 params: { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
177 probeId: this.recordId |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
178 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
179 }); |
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 }, |
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 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
|
183 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
|
184 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
|
185 //Readonly |
1035
479782c96efa
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1034
diff
changeset
|
186 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
|
187 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
|
188 } |
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 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
|
190 this.down('button[action=add]').disable(); |
1035
479782c96efa
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1034
diff
changeset
|
191 } |
479782c96efa
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1034
diff
changeset
|
192 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
|
193 //Writable |
1035
479782c96efa
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1034
diff
changeset
|
194 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
|
195 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
|
196 } |
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
|
197 //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
|
198 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
|
199 } |
823
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
200 }, |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
201 /** |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
202 * 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
|
203 */ |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
204 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
|
205 var grid = this; |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
206 //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
|
207 if (! grid.readOnly) { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
208 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
|
209 } |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
210 }, |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
211 /** |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
212 * 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
|
213 */ |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
214 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
|
215 var grid = this; |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
216 //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
|
217 if (! grid.readOnly) { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
218 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
|
219 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
220 } |
823
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
221 |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
222 }); |