comparison app/view/grid/Messwert.js @ 590:e440b66a859f

Added grid (+controller) for messwerte.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 11 Mar 2015 15:23:16 +0100
parents
children f2742f9b5a64
comparison
equal deleted inserted replaced
589:4c97717b92da 590:e440b66a859f
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
2 * Software engineering by Intevation GmbH
3 *
4 * This file is Free Software under the GNU GPL (v>=3)
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
6 * the documentation coming with IMIS-Labordaten-Application for details.
7 */
8
9 /*
10 * Grid to list Messwerte
11 */
12 Ext.define('Lada.view.grid.Messwert', {
13 extend: 'Ext.grid.Panel',
14 alias: 'widget.messwertgrid',
15
16 requires: [
17 'Lada.view.widget.Messgroesse',
18 'Lada.view.widget.Messeinheit'
19 ],
20
21 maxHeight: 350,
22 emptyText: 'Keine Messwerte gefunden.',
23 minHeight: 110,
24 viewConfig: {
25 deferEmptyText: false
26 },
27 margin: '0, 5, 5, 5',
28
29 recordId: null,
30
31 initComponent: function() {
32 this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
33 clicksToMoveEditor: 1,
34 autoCancel: false
35 });
36
37 this.plugins = [this.rowEditing];
38
39 this.dockedItems = [{
40 xtype: 'toolbar',
41 dock: 'bottom',
42 items: ['->', {
43 text: 'Hinzufügen',
44 icon: 'resources/img/list-add.png',
45 action: 'add',
46 probeId: this.probeId,
47 parentId: this.parentId
48 }, {
49 text: 'Löschen',
50 icon: 'resources/img/list-remove.png',
51 action: 'delete'
52 }]
53 }];
54 this.columns = [{
55 header: 'Messgröße',
56 dataIndex: 'messgroesseId',
57 width: 80,
58 renderer: function(value) {
59 if (!value || value === '') {
60 return '';
61 }
62 var store = Ext.data.StoreManager.get('messgroessen');
63 return store.findRecord('id', value).get('messgroesse');
64 },
65 editor: {
66 xtype: 'combobox',
67 store: Ext.data.StoreManager.get('messgroessen'),
68 displayField: 'messgroesse',
69 valueField: 'id',
70 allowBlank: false
71 }
72 }, {
73 header: 'Messwert',
74 dataIndex: 'messwert',
75 width: 80,
76 editor: {
77 xtype: 'numberfield',
78 allowBlank: false
79 }
80 }, {
81 header: 'Messeinheit',
82 dataIndex: 'mehId',
83 width: 90,
84 renderer: function(value) {
85 if (!value || value === '') {
86 return '';
87 }
88 var store = Ext.data.StoreManager.get('messeinheiten');
89 return store.findRecord('id', value).get('einheit');
90 },
91 editor: {
92 xtype: 'combobox',
93 store: Ext.data.StoreManager.get('messeinheiten'),
94 displayField: 'einheit',
95 valueField: 'id',
96 allowBlank: false
97 }
98 }, {
99 header: '&lt;NWG',
100 width: 60,
101 dataIndex: 'messwertNwg'
102 }, {
103 header: 'Nachweisgrenze',
104 width: 110,
105 dataIndex: 'nwgZuMesswert'
106 }, {
107 header: 'Messfehler',
108 dataIndex: 'messfehler',
109 width: 80,
110 editor: {
111 xtype: 'numberfield',
112 allowBlank: false
113 }
114 }, {
115 header: 'Grenzwertüberschreitung',
116 dataIndex: 'grenzwertueberschreitung',
117 flex: 1,
118 renderer: function(value) {
119 if (value === true) {
120 return 'Ja';
121 }
122 return 'Nein';
123 },
124 editor: {
125 xtype: 'checkbox'
126 }
127 }];
128 this.initData();
129 this.callParent(arguments);
130 },
131
132 initData: function() {
133 console.log('init messwert data');
134 if (this.store) {
135 this.store.removeAll();
136 }
137 else {
138 this.store = Ext.create('Lada.store.Messwerte');
139 }
140 this.store.load({
141 params: {
142 messungsId: this.recordId
143 }
144 });
145 }
146 });

http://lada.wald.intevation.org