Mercurial > lada > lada-client
annotate app/view/grid/Probenzusatzwert.js @ 1186:a1c480be0b79 schema-update
Load status_kombi store on application launch.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 31 Aug 2016 15:59:28 +0200 |
parents | be720d0473f6 |
children | 43f394c10866 |
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 flex: 1, |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
126 editor: { |
1119
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
127 xtype: 'expnumberfield', |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
128 }, |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
129 renderer: function(value) { |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
130 if (!value || value === '') { |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
131 return value; |
b73f9a976c82
Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents:
1054
diff
changeset
|
132 } |
1123
4f68511ce7a4
Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents:
1119
diff
changeset
|
133 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
|
134 .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
|
135 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
|
136 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
|
137 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
|
138 + ((exponent < 0) ? '-' : '+') |
4f68511ce7a4
Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents:
1119
diff
changeset
|
139 + ((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
|
140 + Math.abs(exponent).toString(); |
559
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
141 } |
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 header: 'Maßeinheit', |
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
144 dataIndex: 'pzsId', |
625
f59bda7551d7
Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents:
571
diff
changeset
|
145 flex: 1, |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
146 renderer: function(value) { |
571
1dedce48e3e1
Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
559
diff
changeset
|
147 if (!value || value === '') { |
1dedce48e3e1
Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
559
diff
changeset
|
148 return ''; |
1dedce48e3e1
Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
559
diff
changeset
|
149 } |
559
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
150 var zstore = Ext.data.StoreManager.get('probenzusaetze'); |
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
151 var mstore = Ext.data.StoreManager.get('messeinheiten'); |
1184
be720d0473f6
Fixed probezusatzwert grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1127
diff
changeset
|
152 var mehId = zstore.getById(value).get('messEinheitId'); |
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
|
153 var record = mstore.findRecord('id', mehId, 0, false, false, true); |
1184
be720d0473f6
Fixed probezusatzwert grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1127
diff
changeset
|
154 if (!record) { |
be720d0473f6
Fixed probezusatzwert grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1127
diff
changeset
|
155 return ''; |
be720d0473f6
Fixed probezusatzwert grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1127
diff
changeset
|
156 } |
559
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
157 return record.get('einheit'); |
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
158 } |
9a414a49dffe
Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
548
diff
changeset
|
159 }, { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
160 header: 'rel. Unsich.[%]', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
161 dataIndex: 'messfehler', |
625
f59bda7551d7
Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents:
571
diff
changeset
|
162 xtype: 'numbercolumn', |
f59bda7551d7
Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents:
571
diff
changeset
|
163 format: '0', |
f59bda7551d7
Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents:
571
diff
changeset
|
164 flex: 1, |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
165 editor: { |
625
f59bda7551d7
Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents:
571
diff
changeset
|
166 xtype: 'numberfield', |
665
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
167 allowBlank: false, |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
168 maxLength: 3, |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
169 enforceMaxLength: true, |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
170 allowExponential: false, |
4a9bd2664da6
Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents:
625
diff
changeset
|
171 allowDecimal: false |
625
f59bda7551d7
Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents:
571
diff
changeset
|
172 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
173 }]; |
823
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
174 this.listeners = { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
175 select: { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
176 fn: this.activateRemoveButton, |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
177 scope: this |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
178 }, |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
179 deselect: { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
180 fn: this.deactivateRemoveButton, |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
181 scope: this |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
182 } |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
183 }; |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
184 this.initData(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
185 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
|
186 this.setReadOnly(true); //Grid is always initialised as RO |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
187 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
188 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
189 initData: function() { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
190 this.store = Ext.create('Lada.store.Zusatzwerte'); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
191 this.store.load({ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
192 params: { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
193 probeId: this.recordId |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
194 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
195 }); |
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
|
196 }, |
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
|
197 |
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 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
|
199 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
|
200 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
|
201 //Readonly |
1035
479782c96efa
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1034
diff
changeset
|
202 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
|
203 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
|
204 } |
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
|
205 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
|
206 this.down('button[action=add]').disable(); |
1035
479782c96efa
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1034
diff
changeset
|
207 } |
479782c96efa
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1034
diff
changeset
|
208 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
|
209 //Writable |
1035
479782c96efa
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1034
diff
changeset
|
210 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
|
211 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
|
212 } |
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
|
213 //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
|
214 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
|
215 } |
823
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
216 }, |
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 * 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
|
219 */ |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
220 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
|
221 var grid = this; |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
222 //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
|
223 if (! grid.readOnly) { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
224 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
|
225 } |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
226 }, |
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 * 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
|
229 */ |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
230 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
|
231 var grid = this; |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
232 //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
|
233 if (! grid.readOnly) { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
234 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
|
235 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
236 } |
823
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
723
diff
changeset
|
237 |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
238 }); |