Mercurial > lada > lada-client
comparison app/view/grid/Ort.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 | 69cb367c0a63 |
children | fab0b7be5aca |
comparison
equal
deleted
inserted
replaced
822:a0666d755405 | 823:5ed0e6273888 |
---|---|
25 | 25 |
26 recordId: null, | 26 recordId: null, |
27 | 27 |
28 warnings: null, | 28 warnings: null, |
29 errors: null, | 29 errors: null, |
30 readOnly: true, | |
31 allowDeselect: true, | |
30 | 32 |
31 initComponent: function() { | 33 initComponent: function() { |
32 this.dockedItems = [{ | 34 this.dockedItems = [{ |
33 xtype: 'toolbar', | 35 xtype: 'toolbar', |
34 dock: 'bottom', | 36 dock: 'bottom', |
90 var store = Ext.getStore('locations'); | 92 var store = Ext.getStore('locations'); |
91 var record = store.getById(value); | 93 var record = store.getById(value); |
92 return record.get('bezeichnung'); | 94 return record.get('bezeichnung'); |
93 } | 95 } |
94 }]; | 96 }]; |
97 this.listeners = { | |
98 select: { | |
99 fn: this.activateRemoveButton, | |
100 scope: this | |
101 }, | |
102 deselect: { | |
103 fn: this.deactivateRemoveButton, | |
104 scope: this | |
105 } | |
106 }; | |
95 this.initData(); | 107 this.initData(); |
96 this.callParent(arguments); | 108 this.callParent(arguments); |
109 this.setReadOnly(true); //Grid is always initialised as RO | |
97 }, | 110 }, |
98 | 111 |
99 initData: function() { | 112 initData: function() { |
100 this.store = Ext.create('Lada.store.Orte'); | 113 this.store = Ext.create('Lada.store.Orte'); |
101 this.store.load({ | 114 this.store.load({ |
132 this.getPlugin('rowedit').enable(); | 145 this.getPlugin('rowedit').enable(); |
133 } | 146 } |
134 this.down('button[action=delete]').enable(); | 147 this.down('button[action=delete]').enable(); |
135 this.down('button[action=add]').enable(); | 148 this.down('button[action=add]').enable(); |
136 } | 149 } |
150 }, | |
151 /** | |
152 * Activate the Remove Button | |
153 */ | |
154 activateRemoveButton: function(selection, record) { | |
155 var grid = this; | |
156 //only enable the remove buttone, when the grid is editable. | |
157 if (! grid.readOnly) { | |
158 grid.down('button[action=delete]').enable(); | |
159 } | |
160 }, | |
161 /** | |
162 * Activate the Remove Button | |
163 */ | |
164 deactivateRemoveButton: function(selection, record) { | |
165 var grid = this; | |
166 //only enable the remove buttone, when the grid is editable. | |
167 if (! grid.readOnly) { | |
168 grid.down('button[action=delete]').disable(); | |
169 } | |
137 } | 170 } |
138 }); | 171 }); |