annotate app/view/grid/Probenzusatzwert.js @ 1129:6f5549e50607

add messung tab to FilterManagement
author Michael Stanko <mstanko@bfs.de>
date Tue, 24 May 2016 15:55:05 +0200
parents 4f68511ce7a4
children 5941ee0c7247
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',
1123
4f68511ce7a4 Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents: 1119
diff changeset
97 maxValue: 9.99e+99,
4f68511ce7a4 Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents: 1119
diff changeset
98 minValue: 1e-99
1119
b73f9a976c82 Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents: 1054
diff changeset
99 },
b73f9a976c82 Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents: 1054
diff changeset
100 renderer: function(value) {
b73f9a976c82 Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents: 1054
diff changeset
101 if (!value || value === '') {
b73f9a976c82 Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents: 1054
diff changeset
102 return value;
b73f9a976c82 Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents: 1054
diff changeset
103 }
1123
4f68511ce7a4 Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents: 1119
diff changeset
104 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
105 .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
106 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
107 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
108 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
109 + ((exponent < 0) ? '-' : '+')
4f68511ce7a4 Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents: 1119
diff changeset
110 + ((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
111 + Math.abs(exponent).toString();
665
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 }, {
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
114 header: '< NWG',
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
115 flex: 1,
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
116 renderer: function(value, meta, record) {
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
117 var nwg = record.get('nwgZuMesswert');
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
118 var mw = record.get('messwertPzs');
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
119 if ( mw < nwg) {
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 return '';
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
123 }
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
124 }, {
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
125 header: 'Nachweisgrenze',
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
126 dataIndex: 'nwgZuMesswert',
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
127 xtype: 'numbercolumn',
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
128 flex: 1,
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
129 editor: {
1119
b73f9a976c82 Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents: 1054
diff changeset
130 xtype: 'expnumberfield',
1123
4f68511ce7a4 Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents: 1119
diff changeset
131 maxValue: 9.99e+99,
4f68511ce7a4 Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents: 1119
diff changeset
132 minValue: 1e-99
1119
b73f9a976c82 Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents: 1054
diff changeset
133 },
b73f9a976c82 Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents: 1054
diff changeset
134 renderer: function(value) {
b73f9a976c82 Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents: 1054
diff changeset
135 if (!value || value === '') {
b73f9a976c82 Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents: 1054
diff changeset
136 return value;
b73f9a976c82 Exponential notation without tampering numbers.
Tom Gottfried <tom@intevation.de>
parents: 1054
diff changeset
137 }
1123
4f68511ce7a4 Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents: 1119
diff changeset
138 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
139 .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
140 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
141 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
142 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
143 + ((exponent < 0) ? '-' : '+')
4f68511ce7a4 Restrict range of values to two-digit exponent and format it nicely.
Tom Gottfried <tom@intevation.de>
parents: 1119
diff changeset
144 + ((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
145 + Math.abs(exponent).toString();
559
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
146 }
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
147 }, {
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
148 header: 'Maßeinheit',
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
149 dataIndex: 'pzsId',
625
f59bda7551d7 Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents: 571
diff changeset
150 flex: 1,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151 renderer: function(value) {
571
1dedce48e3e1 Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 559
diff changeset
152 if (!value || value === '') {
1dedce48e3e1 Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 559
diff changeset
153 return '';
1dedce48e3e1 Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 559
diff changeset
154 }
559
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
155 var zstore = Ext.data.StoreManager.get('probenzusaetze');
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
156 var mstore = Ext.data.StoreManager.get('messeinheiten');
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
157 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
158 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
159 return record.get('einheit');
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
160 }
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
161 }, {
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
162 header: 'rel. Unsich.[%]',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
163 dataIndex: 'messfehler',
625
f59bda7551d7 Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents: 571
diff changeset
164 xtype: 'numbercolumn',
f59bda7551d7 Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents: 571
diff changeset
165 format: '0',
f59bda7551d7 Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents: 571
diff changeset
166 flex: 1,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
167 editor: {
625
f59bda7551d7 Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents: 571
diff changeset
168 xtype: 'numberfield',
665
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
169 allowBlank: false,
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
170 maxLength: 3,
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
171 enforceMaxLength: true,
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
172 allowExponential: false,
4a9bd2664da6 Field Validity in Probenzusatzwerte Grid
Dustin Demuth <dustin@intevation.de>
parents: 625
diff changeset
173 allowDecimal: false
625
f59bda7551d7 Xtype numbercolumn hinzugefügt,
Dustin Demuth <dustin@intevation.de>
parents: 571
diff changeset
174 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
175 }];
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
176 this.listeners = {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
177 select: {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
178 fn: this.activateRemoveButton,
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 deselect: {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
182 fn: this.deactivateRemoveButton,
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
183 scope: this
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
184 }
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
185 };
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
186 this.initData();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
187 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
188 this.setReadOnly(true); //Grid is always initialised as RO
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
189 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
190
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
191 initData: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
192 this.store = Ext.create('Lada.store.Zusatzwerte');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
193 this.store.load({
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
194 params: {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
195 probeId: this.recordId
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
196 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
197 });
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 },
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
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
200 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
201 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
202 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
203 //Readonly
1035
479782c96efa Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1034
diff changeset
204 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
205 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
206 }
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 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
208 this.down('button[action=add]').disable();
1035
479782c96efa Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1034
diff changeset
209 }
479782c96efa Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1034
diff changeset
210 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
211 //Writable
1035
479782c96efa Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1034
diff changeset
212 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
213 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
214 }
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
215 //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
216 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
217 }
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
218 },
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 * 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
221 */
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
222 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
223 var grid = this;
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
224 //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
225 if (! grid.readOnly) {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
226 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
227 }
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
228 },
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 * 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
231 */
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
232 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
233 var grid = this;
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
234 //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
235 if (! grid.readOnly) {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
236 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
237 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
238 }
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 723
diff changeset
239
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
240 });

http://lada.wald.intevation.org