annotate app/view/grid/MKommentar.js @ 596:b0a3580a41e9

Added messung kommentar grid and controller.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 12 Mar 2015 09:48:36 +0100
parents
children 13e5473d1af5
rev   line source
596
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 /*
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 * Grid to list Kommentare for Messunge
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 */
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.grid.MKommentar', {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Ext.grid.Panel',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 alias: 'widget.mkommentargrid',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 maxHeight: 350,
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 emptyText: 'Keine Kommentare gefunden.',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 minHeight: 110,
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 viewConfig: {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 deferEmptyText: false
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 },
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 recordId: null,
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 initComponent: function() {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 clicksToMoveEditor: 1,
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 autoCancel: false
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 });
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 this.plugins = [this.rowEditing];
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 this.dockedItems = [{
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 xtype: 'toolbar',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 dock: 'bottom',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 items: ['->', {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 text: 'Hinzufügen',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 icon: 'resources/img/list-add.png',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 action: 'add'
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 }, {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 text: 'Löschen',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 icon: 'resources/img/list-remove.png',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 action: 'delete'
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 }]
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 }];
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 this.columns = [{
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 header: 'Erzeuger',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 dataIndex: 'erzeuger',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 renderer: function(value) {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 if (!value || value === '') {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 return '';
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 }
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 var mstore = Ext.data.StoreManager.get('messstellen');
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 return mstore.getById(value).get('messStelle');
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 },
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 editor: {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 xtype: 'combobox',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 store: Ext.data.StoreManager.get('messstellen'),
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 displayField: 'messStelle',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 valueField: 'id',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 allowBlank: false
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 }
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 }, {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 header: 'Datum',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 dataIndex: 'datum',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 editor: {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 xtype: 'datefield',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 allowBlank: false,
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 format: 'd.m.Y',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 maxValue: Ext.Date.format(new Date(), 'd.m.Y')
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 }
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 }, {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 header: 'Text',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 dataIndex: 'text',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 flex: 1,
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 editor: {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 allowBlank: false
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 }
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 }];
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 this.initData();
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 this.callParent(arguments);
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 },
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 initData: function() {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 if (this.store) {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 this.store.removeAll();
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 }
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 else {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 this.store = Ext.create('Lada.store.MKommentare');
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 }
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 this.store.load({
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 params: {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 messungsId: this.recordId
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 }
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93 });
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 }
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 });

http://lada.wald.intevation.org