Mercurial > lada > lada-client
annotate app/view/grid/MKommentar.js @ 636:f4f76fc04e28
merged.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Mon, 16 Mar 2015 17:32:15 +0100 |
parents | 13e5473d1af5 |
children | 6fe3cef53e74 |
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', |
626
13e5473d1af5
Datum Spalte zu einer Datumsspalte gemacht
Dustin Demuth <dustin@intevation.de>
parents:
596
diff
changeset
|
64 xtype: 'datecolumn', |
13e5473d1af5
Datum Spalte zu einer Datumsspalte gemacht
Dustin Demuth <dustin@intevation.de>
parents:
596
diff
changeset
|
65 format: 'd.m.Y H:i', |
596
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 editor: { |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 xtype: 'datefield', |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 allowBlank: false, |
626
13e5473d1af5
Datum Spalte zu einer Datumsspalte gemacht
Dustin Demuth <dustin@intevation.de>
parents:
596
diff
changeset
|
69 format: 'd.m.Y H:i', |
13e5473d1af5
Datum Spalte zu einer Datumsspalte gemacht
Dustin Demuth <dustin@intevation.de>
parents:
596
diff
changeset
|
70 maxValue: Ext.Date.format(new Date(), 'd.m.Y H:i') |
596
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 } |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 }, { |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 header: 'Text', |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 dataIndex: 'text', |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 flex: 1, |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 editor: { |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 allowBlank: false |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 } |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 }]; |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 this.initData(); |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
81 this.callParent(arguments); |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
82 }, |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
83 |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 initData: function() { |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 if (this.store) { |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
86 this.store.removeAll(); |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 } |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 else { |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 this.store = Ext.create('Lada.store.MKommentare'); |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 } |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 this.store.load({ |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
92 params: { |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 messungsId: this.recordId |
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 }); |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 } |
b0a3580a41e9
Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 }); |