Mercurial > lada > lada-client
comparison app/view/grid/Status.js @ 594:89b337cbfb5d
Added status grid and controller.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 12 Mar 2015 09:46:17 +0100 |
parents | |
children | 73b5b22a5b76 |
comparison
equal
deleted
inserted
replaced
593:9b3adfb7b1ae | 594:89b337cbfb5d |
---|---|
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 Status | |
11 */ | |
12 Ext.define('Lada.view.grid.Status', { | |
13 extend: 'Ext.grid.Panel', | |
14 alias: 'widget.statusgrid', | |
15 | |
16 maxHeight: 350, | |
17 emptyText: 'Keine Statusangaben gefunden.', | |
18 minHeight: 110, | |
19 viewConfig: { | |
20 deferEmptyText: false | |
21 }, | |
22 | |
23 recordId: null, | |
24 | |
25 initComponent: function() { | |
26 this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { | |
27 clicksToMoveEditor: 1, | |
28 autoCancel: false | |
29 }); | |
30 this.plugins = [this.rowEditing]; | |
31 | |
32 var statusStore = Ext.create('Ext.data.Store', { | |
33 fields: ['display', 'id'], | |
34 data: [{ | |
35 display: 'unbekannt', id: 0 | |
36 }, { | |
37 display: 'nicht vergeben', id: 1 | |
38 }, { | |
39 display: 'plausibel', id: 2 | |
40 }, { | |
41 display: 'nicht repräsentativ', id: 3 | |
42 }, { | |
43 display: 'nicht plausibel', id: 4 | |
44 }] | |
45 }); | |
46 this.dockedItems = [{ | |
47 xtype: 'toolbar', | |
48 dock: 'bottom', | |
49 items: ['->', { | |
50 text: 'Hinzufügen', | |
51 icon: 'resources/img/list-add.png', | |
52 action: 'add', | |
53 probeId: this.probeId, | |
54 parentId: this.parentId | |
55 }, { | |
56 text: 'Löschen', | |
57 icon: 'resources/img/list-remove.png', | |
58 action: 'delete' | |
59 }] | |
60 }]; | |
61 this.columns = [{ | |
62 header: 'Erzeuger', | |
63 dataIndex: 'erzeuger', | |
64 renderer: function(value) { | |
65 if (!value || value === '') { | |
66 return ''; | |
67 } | |
68 var mstore = Ext.data.StoreManager.get('messstellen'); | |
69 return mstore.getById(value).get('messStelle'); | |
70 }, | |
71 editor: { | |
72 xtype: 'combobox', | |
73 store: Ext.data.StoreManager.get('messstellen'), | |
74 displayField: 'messStelle', | |
75 valueField: 'id', | |
76 allowBlank: false | |
77 } | |
78 }, { | |
79 header: 'Status', | |
80 dataIndex: 'status', | |
81 renderer: function(value) { | |
82 if (!value || value === '') { | |
83 return ''; | |
84 } | |
85 return statusStore.getById(value).get('display'); | |
86 }, | |
87 editor: { | |
88 xtype: 'combobox', | |
89 store: statusStore, | |
90 displayField: 'display', | |
91 valueField: 'id', | |
92 allowBlank: false | |
93 } | |
94 }, { | |
95 header: 'Datum', | |
96 dataIndex: 'sdatum', | |
97 editor: { | |
98 xtype: 'datefield', | |
99 allowBlank: false, | |
100 format: 'd.m.Y', | |
101 maxValue: Ext.Date.format(new Date(), 'd.m.Y') | |
102 } | |
103 }, { | |
104 header: 'Text', | |
105 dataIndex: 'skommentar', | |
106 flex: 1, | |
107 editor: { | |
108 allowBlank: true | |
109 } | |
110 }]; | |
111 this.initData(); | |
112 this.callParent(arguments); | |
113 }, | |
114 | |
115 initData: function() { | |
116 if (this.store) { | |
117 this.store.removeAll(); | |
118 } | |
119 else { | |
120 this.store = Ext.create('Lada.store.Status'); | |
121 } | |
122 this.store.load({ | |
123 params: { | |
124 messungsId: this.recordId | |
125 } | |
126 }); | |
127 } | |
128 }); |