annotate app/view/zusatzwerte/List.js @ 539:31a770c6a9a9

Merge
author Roland Geider <roland.geider@intevation.de>
date Wed, 17 Dec 2014 15:42:55 +0100
parents eef1ff9f2bd2
children 99e738c17b81
rev   line source
472
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 391
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 391
diff changeset
2 * Software engineering by Intevation GmbH
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 391
diff changeset
3 *
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 391
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 391
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
472
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 391
diff changeset
7 */
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 391
diff changeset
8
351
8cb393ffe844 Added documenation
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 141
diff changeset
9 /*
8cb393ffe844 Added documenation
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 141
diff changeset
10 * Grid to list Probenzusatzwerte
8cb393ffe844 Added documenation
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 141
diff changeset
11 */
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
12 Ext.define('Lada.view.zusatzwerte.List', {
106
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
13 extend: 'Ext.grid.Panel',
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
14 alias: 'widget.zusatzwertelist',
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
15
106
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
16 store: 'Zusatzwerte',
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
17 viewConfig: {
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
18 maxHeight: 350,
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
19 emptyText: 'Keine Zusatzwerte gefunden.',
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
20 // minHeight and deferEmptyText are needed to be able to show the
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
21 // emptyText message.
530
95bad130be98 Increased list grid height.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 513
diff changeset
22 minHeight: 65,
106
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
23 deferEmptyText: false
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
24 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
25
125
324b11db4323 Store probeId as attribute of the "add" button in the zusatzwerte list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 123
diff changeset
26 probeId: null,
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
27
106
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
28 initComponent: function() {
537
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
29 var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
30 clicksToMoveEditor: 1,
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
31 autoCancel: false
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
32 });
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
33 this.plugins = [rowEditing];
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
34 this.dockedItems = [{
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
35 xtype: 'toolbar',
513
6de00657cd87 Moved alll list toolbars to bottom and buttons to the right.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
36 dock: 'bottom',
6de00657cd87 Moved alll list toolbars to bottom and buttons to the right.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
37 items: ['->', {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
38 text: 'Hinzufügen',
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
39 icon: 'gfx/list-add.png',
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
40 action: 'add',
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
41 probeId: this.probeId
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
42 }, {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
43 text: 'Löschen',
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
44 icon: 'gfx/list-remove.png',
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
45 action: 'delete'
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
46 }]
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
47 }];
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
48 this.columns = [{
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
49 header: 'PZW-ID',
537
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
50 dataIndex: 'id',
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
51 editor: {
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
52 xtype: 'numberfield',
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
53 allowBlank: false
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
54 }
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
55 }, {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
56 header: 'PZW-Größe',
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
57 dataIndex: 'pzsId',
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
58 renderer: function(value) {
496
d07e5086a64b Moved stammdaten stores to app.js and load them via storemanager.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 491
diff changeset
59 var store = Ext.data.StoreManager.get('staProbenzusaetze');
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
60 var record = store.getById(value);
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
61 return record.get('beschreibung');
123
d78bb4ca6089 Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 114
diff changeset
62 },
537
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
63 flex: 1,
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
64 editor: {
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
65 xtype: 'probenzusatzwert'
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
66 }
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
67 }, {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
68 header: 'Messwert',
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
69 dataIndex: 'id',
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
70 renderer: function(value) {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
71 var store = Ext.getStore('Zusatzwerte');
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
72 var record = store.getById(value);
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
73 var messwert = record.get('messwertPzs');
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
74 var nwg = record.get('nwgZuMesswert');
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
75 if (messwert < nwg) {
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
76 return '<' + messwert;
123
d78bb4ca6089 Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 114
diff changeset
77 }
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
78 return messwert;
123
d78bb4ca6089 Enabled accessing nested data in the grid through a renderer.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 114
diff changeset
79 }
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
80 }, {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
81 header: 'rel. Unsich.[%]',
537
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
82 dataIndex: 'messfehler',
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
83 editor: {
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
84 allowBlank: false
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
85 }
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
86 }, {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
87 header: 'Maßeinheit',
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
88 dataIndex: 'pzsId',
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
89 renderer: function(value) {
496
d07e5086a64b Moved stammdaten stores to app.js and load them via storemanager.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 491
diff changeset
90 var zstore = Ext.data.StoreManager.get('staProbenzusaetze');
d07e5086a64b Moved stammdaten stores to app.js and load them via storemanager.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 491
diff changeset
91 var mstore = Ext.data.StoreManager.get('staMesseinheiten');
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
92 var mehId = zstore.getById(value).get('mehId');
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
93 var record = mstore.findRecord('id', mehId);
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
94 return record.get('einheit');
537
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
95 }/*,
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
96 editor: {
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
97 xtype: 'messeinheit',
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
98 allowBlank: false
a12c9c97d3cb Make tables editable for 'Zusatzwerte'
Roland Geider <roland.geider@intevation.de>
parents: 513
diff changeset
99 }*/
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
100 }];
106
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
101 this.callParent(arguments);
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
102 }
b91d5376db19 Load Zusatzwerte from server
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
103 });

http://lada.wald.intevation.org