annotate app/view/grid/Probenzusatzwert.js @ 559:9a414a49dffe

Updated probenuzsatzwert grid columns and editors.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 06 Mar 2015 17:05:32 +0100
parents d47ee7439f44
children 1dedce48e3e1
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
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 /*
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 * Grid to list Probenzusatzwerte
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 */
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.grid.Probenzusatzwert', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Ext.grid.Panel',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 alias: 'widget.probenzusatzwertgrid',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 requires: [
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 'Lada.view.widget.Probenzusatzwert'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 ],
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 maxHeight: 350,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 emptyText: 'Keine Zusatzwerte gefunden.',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 minHeight: 110,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 viewConfig: {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 deferEmptyText: false
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 margin: '0, 5, 5, 5',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 recordId: null,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 initComponent: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 clicksToMoveEditor: 1,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 autoCancel: false
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 });
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 this.plugins = [rowEditing];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 this.dockedItems = [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 xtype: 'toolbar',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 dock: 'bottom',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 items: ['->', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 text: 'Hinzufügen',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 icon: 'resources/img/list-add.png',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 action: 'add',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 probeId: this.probeId
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 text: 'Löschen',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 icon: 'resources/img/list-remove.png',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 action: 'delete'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 }]
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 }];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 this.columns = [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 header: 'PZW-ID',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 dataIndex: 'id',
559
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
52 width: 70
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 header: 'PZW-Größe',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 dataIndex: 'pzsId',
559
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
56 flex: 1,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 renderer: function(value) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 var store = Ext.data.StoreManager.get('probenzusaetze');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 var record = store.getById(value);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 return record.get('beschreibung');
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 editor: {
559
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
63 xtype: 'combobox',
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
64 store: Ext.data.StoreManager.get('probenzusaetze'),
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
65 displayField: 'beschreibung',
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
66 valueField: 'id',
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
67 allowBlank: false
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 header: 'Messwert',
559
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
71 dataIndex: 'messwertPzs',
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
72 width: 80,
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
73 renderer: function(value, meta, record) {
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
74 var nwg = record.get('nwgZuMesswert');
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
75 if (value < nwg) {
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
76 return '<' + value;
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
77 }
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
78 return value;
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
79 },
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
80 editor: {
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
81 allowBlank: false
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
82 }
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
83 }, {
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
84 header: 'Maßeinheit',
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
85 dataIndex: 'pzsId',
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
86 width: 80,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 renderer: function(value) {
559
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
88 var zstore = Ext.data.StoreManager.get('probenzusaetze');
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
89 var mstore = Ext.data.StoreManager.get('messeinheiten');
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
90 var mehId = zstore.getById(value).get('mehId');
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
91 var record = mstore.findRecord('id', mehId);
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
92 return record.get('einheit');
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
93 }
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
94 }, {
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
95 header: 'Nachweisgrenze',
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
96 dataIndex: 'nwgZuMesswert',
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
97 width: 110,
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
98 editor: {
9a414a49dffe Updated probenuzsatzwert grid columns and editors.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
99 allowBlank: false
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102 header: 'rel. Unsich.[%]',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
103 dataIndex: 'messfehler',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 editor: {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105 allowBlank: false
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107 }];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
108 this.initData();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
109 this.callParent(arguments);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
110 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
111
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
112 initData: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113 this.store = Ext.create('Lada.store.Zusatzwerte');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114 this.store.load({
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
115 params: {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
116 probeId: this.recordId
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
117 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
118 });
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 });

http://lada.wald.intevation.org