Mercurial > lada > lada-client
annotate app/view/grid/Probenzusatzwert.js @ 1127:5941ee0c7247
Do not constrain range of values.
Zero and (e.g. for temperature) even negative values have to be possible.
As numbers with exponent >99 are unlikely, they are displayed as they are.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Tue, 24 May 2016 15:20:01 +0200 |
parents | 4f68511ce7a4 |
children | be720d0473f6 |
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 } |
1123
4f68511ce7a4
Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents:
1119
diff
changeset
|
102 var strValue = value.toExponential(2).toString() |
4f68511ce7a4
Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents:
1119
diff
changeset
|
103 .replace('.', Ext.util.Format.decimalSeparator); |
4f68511ce7a4
Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents:
1119
diff
changeset
|
104 var splitted = strValue.split('e'); |
4f68511ce7a4
Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents:
1119
diff
changeset
|
105 var exponent = parseInt(splitted[1]); |
4f68511ce7a4
Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents:
1119
diff
changeset
|
106 return splitted[0] + 'e' |
4f68511ce7a4
Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents:
1119
diff
changeset
|
107 + ((exponent < 0) ? '-' : '+') |
4f68511ce7a4
Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents:
1119
diff
changeset
|
108 + ((Math.abs(exponent) < 10) ? '0' : '') |
4f68511ce7a4
Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents:
1119
diff
changeset
|
109 + Math.abs(exponent).toString(); |
665
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: '< NWG', |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
113 flex: 1, |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
114 renderer: function(value, meta, record) { |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
115 var nwg = record.get('nwgZuMesswert'); |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
116 var mw = record.get('messwertPzs'); |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
117 if ( mw < nwg) { |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
118 return '<'; |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
119 } |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
120 return ''; |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
121 } |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
122 }, { |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
123 header: 'Nachweisgrenze', |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
124 dataIndex: 'nwgZuMesswert', |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
125 xtype: 'numbercolumn', |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
126 flex: 1, |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
127 editor: { |
1119
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
128 xtype: 'expnumberfield', |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
129 }, |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
130 renderer: function(value) { |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
131 if (!value || value === '') { |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
132 return value; |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
133 } |
1123
4f68511ce7a4
Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents:
1119
diff
changeset
|
134 var strValue = value.toExponential(2).toString() |
4f68511ce7a4
Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents:
1119
diff
changeset
|
135 .replace('.', Ext.util.Format.decimalSeparator); |
4f68511ce7a4
Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents:
1119
diff
changeset
|
136 var splitted = strValue.split('e'); |
4f68511ce7a4
Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents:
1119
diff
changeset
|
137 var exponent = parseInt(splitted[1]); |
4f68511ce7a4
Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents:
1119
diff
changeset
|
138 return splitted[0] + 'e' |
4f68511ce7a4
Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents:
1119
diff
changeset
|
139 + ((exponent < 0) ? '-' : '+') |
4f68511ce7a4
Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents:
1119
diff
changeset
|
140 + ((Math.abs(exponent) < 10) ? '0' : '') |
4f68511ce7a4
Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents:
1119
diff
changeset
|
141 + Math.abs(exponent).toString(); |
559
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 }, { |
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
144 header: 'Maßeinheit', |
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
145 dataIndex: 'pzsId', |
625
f59bda7551d7
Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents:
571
diff
changeset
|
146 flex: 1, |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
147 renderer: function(value) { |
571
1dedce48e3e1
Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
559
diff
changeset
|
148 if (!value || value === '') { |
1dedce48e3e1
Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
559
diff
changeset
|
149 return ''; |
1dedce48e3e1
Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
559
diff
changeset
|
150 } |
559
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
151 var zstore = Ext.data.StoreManager.get('probenzusaetze'); |
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
152 var mstore = Ext.data.StoreManager.get('messeinheiten'); |
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
153 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
|
154 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
|
155 return record.get('einheit'); |
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
156 } |
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
157 }, { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
158 header: 'rel. Unsich.[%]', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
159 dataIndex: 'messfehler', |
625
f59bda7551d7
Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents:
571
diff
changeset
|
160 xtype: 'numbercolumn', |
f59bda7551d7
Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents:
571
diff
changeset
|
161 format: '0', |
f59bda7551d7
Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents:
571
diff
changeset
|
162 flex: 1, |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
163 editor: { |
625
f59bda7551d7
Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents:
571
diff
changeset
|
164 xtype: 'numberfield', |
665
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
165 allowBlank: false, |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
166 maxLength: 3, |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
167 enforceMaxLength: true, |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
168 allowExponential: false, |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
169 allowDecimal: false |
625
f59bda7551d7
Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents:
571
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:
723
diff
changeset
|
172 this.listeners = { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
173 select: { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
174 fn: this.activateRemoveButton, |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
175 scope: this |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
176 }, |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
177 deselect: { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
178 fn: this.deactivateRemoveButton, |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
179 scope: this |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
180 } |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
181 }; |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
182 this.initData(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
183 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
|
184 this.setReadOnly(true); //Grid is always initialised as RO |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
185 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
186 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
187 initData: function() { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
188 this.store = Ext.create('Lada.store.Zusatzwerte'); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
189 this.store.load({ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
190 params: { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
191 probeId: this.recordId |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
192 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
193 }); |
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
|
194 }, |
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 |
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 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
|
197 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
|
198 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
|
199 //Readonly |
1035
479782c96efa
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1034
diff
changeset
|
200 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
|
201 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
|
202 } |
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
|
203 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
|
204 this.down('button[action=add]').disable(); |
1035
479782c96efa
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1034
diff
changeset
|
205 } |
479782c96efa
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1034
diff
changeset
|
206 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
|
207 //Writable |
1035
479782c96efa
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1034
diff
changeset
|
208 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
|
209 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
|
210 } |
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
|
211 //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
|
212 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
|
213 } |
823
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
214 }, |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
215 /** |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
216 * 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
|
217 */ |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
218 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
|
219 var grid = this; |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
220 //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
|
221 if (! grid.readOnly) { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
222 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
|
223 } |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
224 }, |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
225 /** |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
226 * 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
|
227 */ |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
228 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
|
229 var grid = this; |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
230 //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
|
231 if (! grid.readOnly) { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
232 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
|
233 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
234 } |
823
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
235 |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
236 }); |