comparison app/view/grid/MKommentar.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 7f11b75e0188
children 07dfcdf5b41f
comparison
equal deleted inserted replaced
823:5ed0e6273888 824:fab0b7be5aca
19 viewConfig: { 19 viewConfig: {
20 deferEmptyText: false 20 deferEmptyText: false
21 }, 21 },
22 22
23 recordId: null, 23 recordId: null,
24 readOnly: true,
25 allowDeselect: true,
24 26
25 initComponent: function() { 27 initComponent: function() {
26 this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { 28 this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
27 clicksToMoveEditor: 1, 29 clicksToMoveEditor: 1,
28 autoCancel: false, 30 autoCancel: false,
93 allowBlank: false, 95 allowBlank: false,
94 maxLength: 1000, 96 maxLength: 1000,
95 enforceMaxLength: true 97 enforceMaxLength: true
96 } 98 }
97 }]; 99 }];
100 this.listeners = {
101 select: {
102 fn: this.activateRemoveButton,
103 scope: this
104 },
105 deselect: {
106 fn: this.deactivateRemoveButton,
107 scope: this
108 }
109 };
98 this.initData(); 110 this.initData();
99 this.callParent(arguments); 111 this.callParent(arguments);
112 this.setReadOnly(true); //Grid is always initialised as RO
100 }, 113 },
101 114
102 initData: function() { 115 initData: function() {
103 if (this.store) { 116 if (this.store) {
104 this.store.removeAll(); 117 this.store.removeAll();
124 }else{ 137 }else{
125 //Writable 138 //Writable
126 if (this.getPlugin('rowedit')){ 139 if (this.getPlugin('rowedit')){
127 this.getPlugin('rowedit').enable(); 140 this.getPlugin('rowedit').enable();
128 } 141 }
129 this.down('button[action=delete]').enable(); 142 //this.down('button[action=delete]').enable();
130 this.down('button[action=add]').enable(); 143 this.down('button[action=add]').enable();
144 }
145 },
146 /**
147 * Activate the Remove Button
148 */
149 activateRemoveButton: function(selection, record) {
150 var grid = this;
151 //only enable the remove buttone, when the grid is editable.
152 if (! grid.readOnly) {
153 grid.down('button[action=delete]').enable();
154 }
155 },
156 /**
157 * Activate the Remove Button
158 */
159 deactivateRemoveButton: function(selection, record) {
160 var grid = this;
161 //only enable the remove buttone, when the grid is editable.
162 if (! grid.readOnly) {
163 grid.down('button[action=delete]').disable();
131 } 164 }
132 } 165 }
133 }); 166 });

http://lada.wald.intevation.org