comparison app/view/grid/Status.js @ 969:d4603049cd42

Fixed edit status. Only the last record is editable.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 12 Nov 2015 17:38:57 +0100
parents 8fabf9a3fee7
children c2a726887dd7
comparison
equal deleted inserted replaced
968:8fabf9a3fee7 969:d4603049cd42
36 36
37 this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { 37 this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
38 clicksToMoveEditor: 1, 38 clicksToMoveEditor: 1,
39 autoCancel: false, 39 autoCancel: false,
40 disabled: true, 40 disabled: true,
41 pluginId: 'rowedit', 41 pluginId: 'rowedit'
42 listeners:{
43 // Make row ineditable when readonly is set to true
44 // Normally this would belong into a controller an not the view.
45 // But the RowEditPlugin is not handled there.
46 beforeedit: function(e, o) {
47 var readonlywin = o.grid.up('window').record.get('readonly');
48 var readonlygrid = o.record.get('readonly');
49 if (readonlywin == true || readonlygrid == true || this.disabled) {
50 return false;
51 }
52 return true;
53 }
54 }
55 }); 42 });
56 this.plugins = [this.rowEditing]; 43 this.plugins = [this.rowEditing];
57 44
58 this.dockedItems = [{ 45 this.dockedItems = [{
59 xtype: 'toolbar', 46 xtype: 'toolbar',
170 }, 157 },
171 158
172 setReadOnly: function(b) { 159 setReadOnly: function(b) {
173 if (b == true){ 160 if (b == true){
174 //Readonly 161 //Readonly
175 if (this.getPlugin('rowedit')){
176 this.getPlugin('rowedit').disable();
177 }
178 this.down('button[action=add]').disable(); 162 this.down('button[action=add]').disable();
179 }else{ 163 }else{
180 //Writable 164 //Writable
181 if (this.getPlugin('rowedit')){
182 this.getPlugin('rowedit').enable();
183 }
184 //this.down('button[action=delete]').enable();
185 this.down('button[action=add]').enable(); 165 this.down('button[action=add]').enable();
186 } 166 }
187 } 167 }
188 }); 168 });

http://lada.wald.intevation.org