Mercurial > lada > lada-client
annotate app/view/grid/Messmethoden.js @ 757:b8502964f5c3
Added missing files. Added MmtMockup
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Wed, 06 May 2015 14:15:37 +0200 |
parents | |
children | b2fcbdc4969d |
rev | line source |
---|---|
757
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
3 * |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
7 */ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
8 |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
9 /* |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
10 * Grid to list Messmethoden |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
11 */ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
12 Ext.define('Lada.view.grid.Messmethoden', { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
13 extend: 'Ext.grid.Panel', |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
14 alias: 'widget.messmethodengrid', |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
15 |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
16 requires: [ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
17 'Lada.view.widget.Messmethode' |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
18 ], |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
19 |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
20 maxHeight: 350, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
21 minHeight: 110, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
22 viewConfig: { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
23 deferEmptyText: false |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
24 }, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
25 margin: '0, 5, 5, 5', |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
26 |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
27 recordId: null, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
28 |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
29 initComponent: function() { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
30 var i18n = Lada.getApplication().bundle; |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
31 this.emptyText = i18n.getMsg('emptytext.mmtgrid'); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
32 |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
33 this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
34 clicksToMoveEditor: 1, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
35 autoCancel: false, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
36 disabled: false, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
37 pluginId: 'rowedit', |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
38 listeners:{ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
39 // Make row ineditable when readonly is set to true |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
40 // Normally this would belong into a controller an not the view. |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
41 // But the RowEditPlugin is not handled there. |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
42 beforeedit: function(e, o) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
43 var readonlywin = o.grid.up('window').record.get('readonly'); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
44 var readonlygrid = o.record.get('readonly'); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
45 if (readonlywin == true || readonlygrid == true || this.disabled) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
46 return false; |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
47 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
48 return true; |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
49 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
50 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
51 }); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
52 |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
53 this.plugins = [this.rowEditing]; |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
54 |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
55 this.dockedItems = [{ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
56 xtype: 'toolbar', |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
57 dock: 'bottom', |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
58 items: ['->', { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
59 text: i18n.getMsg('add'), |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
60 icon: 'resources/img/list-add.png', |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
61 action: 'add', |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
62 probeId: this.probeId, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
63 parentId: this.parentId |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
64 }, { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
65 text: i18n.getMsg('delete'), |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
66 icon: 'resources/img/list-remove.png', |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
67 action: 'delete' |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
68 }] |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
69 }]; |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
70 this.columns = [{ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
71 header: 'Messmethode', |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
72 dataIndex: 'id', |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
73 flex: 1, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
74 renderer: function(value) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
75 if (!value || value === '') { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
76 return ''; |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
77 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
78 var store = Ext.data.StoreManager.get('messmethode'); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
79 return store.findRecord('mprId', value, 0, false, false, true).get('messmethode'); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
80 }, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
81 editor: { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
82 xtype: 'combobox', |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
83 store: Ext.data.StoreManager.get('messmethode'), |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
84 displayField: 'messmethode', |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
85 valueField: 'id', |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
86 allowBlank: false, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
87 editable: true, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
88 forceSelection: true, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
89 autoSelect: true, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
90 queryMode: 'local', |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
91 minChars: 0, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
92 typeAhead: false, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
93 triggerAction: 'all' |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
94 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
95 }]; |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
96 this.initData(); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
97 this.callParent(arguments); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
98 }, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
99 |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
100 initData: function() { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
101 if (this.store) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
102 this.store.removeAll(); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
103 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
104 else { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
105 this.store = Ext.create('Lada.store.MmtMessprogramm'); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
106 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
107 this.store.load({ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
108 params: { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
109 mprId: this.recordId |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
110 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
111 }); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
112 }, |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
113 |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
114 setReadOnly: function(b) { |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
115 if (b == true){ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
116 //Readonly |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
117 if (this.getPlugin('rowedit')){ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
118 this.getPlugin('rowedit').disable(); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
119 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
120 this.down('button[action=delete]').disable(); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
121 this.down('button[action=add]').disable(); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
122 }else{ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
123 //Writable |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
124 if (this.getPlugin('rowedit')){ |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
125 this.getPlugin('rowedit').enable(); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
126 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
127 this.down('button[action=delete]').enable(); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
128 this.down('button[action=add]').enable(); |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
129 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
130 } |
b8502964f5c3
Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
131 }); |