annotate app/view/grid/MKommentar.js @ 664:6fe3cef53e74

Field Validity in MKommentar Grid
author Dustin Demuth <dustin@intevation.de>
date Thu, 19 Mar 2015 11:25:38 +0100
parents 13e5473d1af5
children 612f4f933083
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',
664
6fe3cef53e74 Field Validity in MKommentar Grid
Dustin Demuth <dustin@intevation.de>
parents: 626
diff changeset
59 allowBlank: false,
6fe3cef53e74 Field Validity in MKommentar Grid
Dustin Demuth <dustin@intevation.de>
parents: 626
diff changeset
60 editable: false,
596
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 }, {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 header: 'Datum',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 dataIndex: 'datum',
626
13e5473d1af5 Datum Spalte zu einer Datumsspalte gemacht
Dustin Demuth <dustin@intevation.de>
parents: 596
diff changeset
65 xtype: 'datecolumn',
664
6fe3cef53e74 Field Validity in MKommentar Grid
Dustin Demuth <dustin@intevation.de>
parents: 626
diff changeset
66 format: 'd.m.Y',
596
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 editor: {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 xtype: 'datefield',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 allowBlank: false,
664
6fe3cef53e74 Field Validity in MKommentar Grid
Dustin Demuth <dustin@intevation.de>
parents: 626
diff changeset
70 format: 'd.m.Y',
6fe3cef53e74 Field Validity in MKommentar Grid
Dustin Demuth <dustin@intevation.de>
parents: 626
diff changeset
71 maxValue: Ext.Date.format(new Date(), 'd.m.Y')
596
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 }, {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 header: 'Text',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 dataIndex: 'text',
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 flex: 1,
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 editor: {
664
6fe3cef53e74 Field Validity in MKommentar Grid
Dustin Demuth <dustin@intevation.de>
parents: 626
diff changeset
78 allowBlank: false,
6fe3cef53e74 Field Validity in MKommentar Grid
Dustin Demuth <dustin@intevation.de>
parents: 626
diff changeset
79 maxLength: 1000,
6fe3cef53e74 Field Validity in MKommentar Grid
Dustin Demuth <dustin@intevation.de>
parents: 626
diff changeset
80 enforceMaxLength: true
596
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 }];
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 this.initData();
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 this.callParent(arguments);
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
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 initData: function() {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 if (this.store) {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 this.store.removeAll();
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 else {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 this.store = Ext.create('Lada.store.MKommentare');
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 this.store.load({
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 params: {
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 messungsId: this.recordId
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 }
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 });
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 }
b0a3580a41e9 Added messung kommentar grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 });

http://lada.wald.intevation.org