Mercurial > lada > lada-client
comparison app/view/grid/Nuklide.js @ 766:31eaed998531
enabled removal and creation of messgroessen for a messmethode
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Tue, 12 May 2015 14:24:41 +0200 |
parents | ba8c0e754979 |
children | 5ee59111b188 |
comparison
equal
deleted
inserted
replaced
765:62721a75d31d | 766:31eaed998531 |
---|---|
11 */ | 11 */ |
12 Ext.define('Lada.view.grid.Nuklide', { | 12 Ext.define('Lada.view.grid.Nuklide', { |
13 extend: 'Ext.grid.Panel', | 13 extend: 'Ext.grid.Panel', |
14 alias: 'widget.nuklidegrid', | 14 alias: 'widget.nuklidegrid', |
15 | 15 |
16 selType: 'checkboxmodel', | |
17 selModel: { | |
18 checkOnly: false, | |
19 injectCheckbox: 0 | |
20 }, | |
21 requires: [ | 16 requires: [ |
22 'Lada.view.widget.Messgroesse' | 17 'Lada.view.widget.Messgroesse' |
23 ], | 18 ], |
24 | 19 |
25 maxHeight: 350, | 20 maxHeight: 350, |
37 | 32 |
38 this.dockedItems = [{ | 33 this.dockedItems = [{ |
39 xtype: 'toolbar', | 34 xtype: 'toolbar', |
40 dock: 'bottom', | 35 dock: 'bottom', |
41 items: ['->', { | 36 items: ['->', { |
42 text: i18n.getMsg('save'), | 37 text: i18n.getMsg('add'), |
43 qtip: i18n.getMsg('save.qtip'), | 38 qtip: i18n.getMsg('add.qtip'), |
44 icon: 'resources/img/dialog-ok-apply.png', | 39 icon: 'resources/img/list-add.png', |
45 action: 'save', | 40 action: 'add', |
46 disabled: true | 41 disabled: true |
47 }, { | 42 }, { |
48 text: i18n.getMsg('discard'), | 43 text: i18n.getMsg('delete'), |
49 qtip: i18n.getMsg('discard.qtip'), | 44 qtip: i18n.getMsg('delete.qtip'), |
50 icon: 'resources/img/dialog-cancel.png', | 45 icon: 'resources/img/list-remove.png', |
51 action: 'discard', | 46 action: 'remove', |
52 disabled: true | 47 disabled: true |
53 }] | 48 }] |
54 }]; | 49 }]; |
55 this.columns = [{ | 50 this.columns = [{ |
56 header: i18n.getMsg('nuklid'), | 51 header: i18n.getMsg('nuklid'), |
63 var store = Ext.data.StoreManager.get('messgroessen'); | 58 var store = Ext.data.StoreManager.get('messgroessen'); |
64 if (!store) { | 59 if (!store) { |
65 store = Ext.create('Lada.store.Messgroessen'); | 60 store = Ext.create('Lada.store.Messgroessen'); |
66 } | 61 } |
67 return store.findRecord('id', value, 0, false, false, true).get('messgroesse'); | 62 return store.findRecord('id', value, 0, false, false, true).get('messgroesse'); |
63 }, | |
64 editor: { | |
65 xtype: 'combobox', | |
66 store: Ext.data.StoreManager.get('messgroessen'), | |
67 valueField: 'id', | |
68 allowBlank: false, | |
69 editable: true, | |
70 forceSelection: true, | |
71 autoSelect: true, | |
72 //multiSelect: true, // TODO | |
73 queryMode: 'local', | |
74 minChars: 0, | |
75 typeAhead: false, | |
76 triggerAction: 'all', | |
77 tpl: Ext.create("Ext.XTemplate", | |
78 '<tpl for="."><div class="x-combo-list-item x-boundlist-item" >' + | |
79 '{messgroesse}</div></tpl>'), | |
80 displayTpl: Ext.create('Ext.XTemplate', | |
81 '<tpl for=".">{messgroesse}</tpl>'), | |
68 } | 82 } |
69 }]; | 83 }]; |
84 | |
85 this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { | |
86 clicksToMoveEditor: 1, | |
87 autoCancel: false, | |
88 disabled: false, | |
89 pluginId: 'nuklidrowedit', | |
90 listeners:{ | |
91 // Make row ineditable when readonly is set to true | |
92 // Normally this would belong into a controller an not the view. | |
93 // But the RowEditPlugin is not handled there. | |
94 beforeedit: function(e, o) { | |
95 var readonlywin = o.grid.up('window').record.get('readonly'); | |
96 var readonlygrid = o.record.get('readonly'); | |
97 if (readonlywin == true || readonlygrid == true || this.disabled) { | |
98 return false; | |
99 } | |
100 return true; | |
101 } | |
102 } | |
103 }); | |
104 | |
105 this.plugins = [this.rowEditing]; | |
106 | |
70 this.initData(); | 107 this.initData(); |
71 this.callParent(arguments); | 108 this.callParent(arguments); |
72 }, | 109 }, |
73 initData: function() { | 110 initData: function() { |
74 if (this.store) { | 111 if (this.store) { |
75 this.store.removeAll(); | 112 this.store.reload(); |
76 } | 113 } |
77 }, | 114 }, |
78 setData: function(store) { | 115 setData: function(store) { |
79 this.setLoading(true); | 116 this.setLoading(true); |
80 this.reconfigure(store); | 117 this.reconfigure(store); |
84 if (b == true){ | 121 if (b == true){ |
85 //Readonly | 122 //Readonly |
86 if (this.getPlugin('rowedit')){ | 123 if (this.getPlugin('rowedit')){ |
87 this.getPlugin('rowedit').disable(); | 124 this.getPlugin('rowedit').disable(); |
88 } | 125 } |
89 this.down('button[action=discard]').disable(); | 126 this.down('button[action=add]').disable(); |
90 this.down('button[action=save]').disable(); | 127 this.down('button[action=remove]').disable(); |
91 }else{ | 128 }else{ |
92 //Writable | 129 //Writable |
93 if (this.getPlugin('rowedit')){ | 130 if (this.getPlugin('rowedit')){ |
94 this.getPlugin('rowedit').enable(); | 131 this.getPlugin('rowedit').enable(); |
95 } | 132 } |
96 this.down('button[action=discard]').enable(); | 133 this.down('button[action=add]').enable(); |
97 this.down('button[action=save]').enable(); | 134 this.down('button[action=remove]').enable(); |
98 } | 135 } |
99 } | 136 } |
100 }); | 137 }); |