comparison 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
comparison
equal deleted inserted replaced
756:f2db1ae1d012 757:b8502964f5c3
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 Messmethoden
11 */
12 Ext.define('Lada.view.grid.Messmethoden', {
13 extend: 'Ext.grid.Panel',
14 alias: 'widget.messmethodengrid',
15
16 requires: [
17 'Lada.view.widget.Messmethode'
18 ],
19
20 maxHeight: 350,
21 minHeight: 110,
22 viewConfig: {
23 deferEmptyText: false
24 },
25 margin: '0, 5, 5, 5',
26
27 recordId: null,
28
29 initComponent: function() {
30 var i18n = Lada.getApplication().bundle;
31 this.emptyText = i18n.getMsg('emptytext.mmtgrid');
32
33 this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
34 clicksToMoveEditor: 1,
35 autoCancel: false,
36 disabled: false,
37 pluginId: 'rowedit',
38 listeners:{
39 // Make row ineditable when readonly is set to true
40 // Normally this would belong into a controller an not the view.
41 // But the RowEditPlugin is not handled there.
42 beforeedit: function(e, o) {
43 var readonlywin = o.grid.up('window').record.get('readonly');
44 var readonlygrid = o.record.get('readonly');
45 if (readonlywin == true || readonlygrid == true || this.disabled) {
46 return false;
47 }
48 return true;
49 }
50 }
51 });
52
53 this.plugins = [this.rowEditing];
54
55 this.dockedItems = [{
56 xtype: 'toolbar',
57 dock: 'bottom',
58 items: ['->', {
59 text: i18n.getMsg('add'),
60 icon: 'resources/img/list-add.png',
61 action: 'add',
62 probeId: this.probeId,
63 parentId: this.parentId
64 }, {
65 text: i18n.getMsg('delete'),
66 icon: 'resources/img/list-remove.png',
67 action: 'delete'
68 }]
69 }];
70 this.columns = [{
71 header: 'Messmethode',
72 dataIndex: 'id',
73 flex: 1,
74 renderer: function(value) {
75 if (!value || value === '') {
76 return '';
77 }
78 var store = Ext.data.StoreManager.get('messmethode');
79 return store.findRecord('mprId', value, 0, false, false, true).get('messmethode');
80 },
81 editor: {
82 xtype: 'combobox',
83 store: Ext.data.StoreManager.get('messmethode'),
84 displayField: 'messmethode',
85 valueField: 'id',
86 allowBlank: false,
87 editable: true,
88 forceSelection: true,
89 autoSelect: true,
90 queryMode: 'local',
91 minChars: 0,
92 typeAhead: false,
93 triggerAction: 'all'
94 }
95 }];
96 this.initData();
97 this.callParent(arguments);
98 },
99
100 initData: function() {
101 if (this.store) {
102 this.store.removeAll();
103 }
104 else {
105 this.store = Ext.create('Lada.store.MmtMessprogramm');
106 }
107 this.store.load({
108 params: {
109 mprId: this.recordId
110 }
111 });
112 },
113
114 setReadOnly: function(b) {
115 if (b == true){
116 //Readonly
117 if (this.getPlugin('rowedit')){
118 this.getPlugin('rowedit').disable();
119 }
120 this.down('button[action=delete]').disable();
121 this.down('button[action=add]').disable();
122 }else{
123 //Writable
124 if (this.getPlugin('rowedit')){
125 this.getPlugin('rowedit').enable();
126 }
127 this.down('button[action=delete]').enable();
128 this.down('button[action=add]').enable();
129 }
130 }
131 });

http://lada.wald.intevation.org