comparison app/view/grid/Status.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 ad24af3fcf89
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,
114 allowBlank: true, 116 allowBlank: true,
115 maxLength: 1000, 117 maxLength: 1000,
116 enforceMaxLength: true 118 enforceMaxLength: true
117 } 119 }
118 }]; 120 }];
121 this.listeners = {
122 select: {
123 fn: this.activateRemoveButton,
124 scope: this
125 },
126 deselect: {
127 fn: this.deactivateRemoveButton,
128 scope: this
129 }
130 };
119 this.initData(); 131 this.initData();
120 this.callParent(arguments); 132 this.callParent(arguments);
133 this.setReadOnly(true); //Grid is always initialised as RO
121 }, 134 },
122 135
123 initData: function() { 136 initData: function() {
124 if (this.store) { 137 if (this.store) {
125 this.store.removeAll(); 138 this.store.removeAll();
145 }else{ 158 }else{
146 //Writable 159 //Writable
147 if (this.getPlugin('rowedit')){ 160 if (this.getPlugin('rowedit')){
148 this.getPlugin('rowedit').enable(); 161 this.getPlugin('rowedit').enable();
149 } 162 }
150 this.down('button[action=delete]').enable(); 163 //this.down('button[action=delete]').enable();
151 this.down('button[action=add]').enable(); 164 this.down('button[action=add]').enable();
165 }
166 },
167 /**
168 * Activate the Remove Button
169 */
170 activateRemoveButton: function(selection, record) {
171 var grid = this;
172 //only enable the remove buttone, when the grid is editable.
173 if (! grid.readOnly) {
174 grid.down('button[action=delete]').enable();
175 }
176 },
177 /**
178 * Activate the Remove Button
179 */
180 deactivateRemoveButton: function(selection, record) {
181 var grid = this;
182 //only enable the remove buttone, when the grid is editable.
183 if (! grid.readOnly) {
184 grid.down('button[action=delete]').disable();
152 } 185 }
153 } 186 }
154 }); 187 });

http://lada.wald.intevation.org