comparison app/view/grid/Messwert.js @ 824:fab0b7be5aca

add disbled remove button to all grids which relate to proben or messungen. Messprogramme-grids are untouched. BUG: When the last entry is deleted, the button remains active
author Dustin Demuth <dustin@intevation.de>
date Fri, 29 May 2015 14:23:03 +0200
parents 2e8da590ea0c
children 613ad3263e59
comparison
equal deleted inserted replaced
823:5ed0e6273888 824:fab0b7be5aca
25 deferEmptyText: false 25 deferEmptyText: false
26 }, 26 },
27 margin: '0, 5, 5, 5', 27 margin: '0, 5, 5, 5',
28 28
29 recordId: null, 29 recordId: null,
30 readOnly: true,
31 allowDeselect: true,
30 32
31 initComponent: function() { 33 initComponent: function() {
32 this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { 34 this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
33 clicksToMoveEditor: 1, 35 clicksToMoveEditor: 1,
34 autoCancel: false, 36 autoCancel: false,
162 }, 164 },
163 editor: { 165 editor: {
164 xtype: 'checkbox' 166 xtype: 'checkbox'
165 } 167 }
166 }]; 168 }];
169 this.listeners = {
170 select: {
171 fn: this.activateRemoveButton,
172 scope: this
173 },
174 deselect: {
175 fn: this.deactivateRemoveButton,
176 scope: this
177 }
178 };
167 this.initData(); 179 this.initData();
168 this.callParent(arguments); 180 this.callParent(arguments);
181 this.setReadOnly(true); //Grid is always initialised as RO
169 }, 182 },
170 183
171 initData: function() { 184 initData: function() {
172 if (this.store) { 185 if (this.store) {
173 this.store.removeAll(); 186 this.store.removeAll();
193 }else{ 206 }else{
194 //Writable 207 //Writable
195 if (this.getPlugin('rowedit')){ 208 if (this.getPlugin('rowedit')){
196 this.getPlugin('rowedit').enable(); 209 this.getPlugin('rowedit').enable();
197 } 210 }
198 this.down('button[action=delete]').enable(); 211 //this.down('button[action=delete]').enable();
199 this.down('button[action=add]').enable(); 212 this.down('button[action=add]').enable();
200 } 213 }
214 },
215 /**
216 * Activate the Remove Button
217 */
218 activateRemoveButton: function(selection, record) {
219 var grid = this;
220 //only enable the remove buttone, when the grid is editable.
221 if (! grid.readOnly) {
222 grid.down('button[action=delete]').enable();
223 }
224 },
225 /**
226 * Activate the Remove Button
227 */
228 deactivateRemoveButton: function(selection, record) {
229 var grid = this;
230 //only enable the remove buttone, when the grid is editable.
231 if (! grid.readOnly) {
232 grid.down('button[action=delete]').disable();
233 }
201 } 234 }
202 }); 235 });

http://lada.wald.intevation.org