Mercurial > lada > lada-client
comparison app/view/grid/Messung.js @ 823:5ed0e6273888
Only enable delete button in grids when an entry was selected
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Fri, 29 May 2015 14:03:18 +0200 |
parents | ee8cce4b4522 |
children | 07dfcdf5b41f |
comparison
equal
deleted
inserted
replaced
822:a0666d755405 | 823:5ed0e6273888 |
---|---|
23 | 23 |
24 recordId: null, | 24 recordId: null, |
25 | 25 |
26 warnings: null, | 26 warnings: null, |
27 errors: null, | 27 errors: null, |
28 readOnly: true, | |
29 allowDeselect: true, | |
28 | 30 |
29 initComponent: function() { | 31 initComponent: function() { |
30 this.dockedItems = [{ | 32 this.dockedItems = [{ |
31 xtype: 'toolbar', | 33 xtype: 'toolbar', |
32 dock: 'bottom', | 34 dock: 'bottom', |
119 var id = 'messung-kommentar-item' + value; | 121 var id = 'messung-kommentar-item' + value; |
120 this.updateKommentare(value, id); | 122 this.updateKommentare(value, id); |
121 return '<div id="' + id + '">Lade...</div>'; | 123 return '<div id="' + id + '">Lade...</div>'; |
122 } | 124 } |
123 }]; | 125 }]; |
126 this.listeners = { | |
127 select: { | |
128 fn: this.activateRemoveButton, | |
129 scope: this | |
130 }, | |
131 deselect: { | |
132 fn: this.deactivateRemoveButton, | |
133 scope: this | |
134 } | |
135 }; | |
124 this.initData(); | 136 this.initData(); |
125 this.callParent(arguments); | 137 this.callParent(arguments); |
138 this.setReadOnly(true); //Grid is always initialised as RO | |
126 }, | 139 }, |
127 | 140 |
128 initData: function() { | 141 initData: function() { |
129 this.store = Ext.create('Lada.store.Messungen'); | 142 this.store = Ext.create('Lada.store.Messungen'); |
130 this.store.load({ | 143 this.store.load({ |
210 }else{ | 223 }else{ |
211 //Writable | 224 //Writable |
212 if (this.getPlugin('rowedit')){ | 225 if (this.getPlugin('rowedit')){ |
213 this.getPlugin('rowedit').enable(); | 226 this.getPlugin('rowedit').enable(); |
214 } | 227 } |
215 this.down('button[action=delete]').enable(); | 228 //this.down('button[action=delete]').enable(); |
229 //always disabled, unless a row was selected | |
216 this.down('button[action=add]').enable(); | 230 this.down('button[action=add]').enable(); |
231 } | |
232 }, | |
233 /** | |
234 * Activate the Remove Button | |
235 */ | |
236 activateRemoveButton: function(selection, record) { | |
237 var grid = this; | |
238 //only enable the remove buttone, when the grid is editable. | |
239 if (! grid.readOnly) { | |
240 grid.down('button[action=delete]').enable(); | |
241 } | |
242 }, | |
243 /** | |
244 * Activate the Remove Button | |
245 */ | |
246 deactivateRemoveButton: function(selection, record) { | |
247 var grid = this; | |
248 //only enable the remove buttone, when the grid is editable. | |
249 if (! grid.readOnly) { | |
250 grid.down('button[action=delete]').disable(); | |
217 } | 251 } |
218 } | 252 } |
219 }); | 253 }); |