# HG changeset patch # User Dustin Demuth # Date 1447327142 -3600 # Node ID 5b86baa038bc3e29339635a8cb68b8b569238ee6 # Parent 6a6f2c6fe8ee185da17f8d2bfe8443a1b2725464 removed delete button for messung-status diff -r 6a6f2c6fe8ee -r 5b86baa038bc app/controller/grid/Status.js --- a/app/controller/grid/Status.js Thu Nov 12 12:13:31 2015 +0100 +++ b/app/controller/grid/Status.js Thu Nov 12 12:19:02 2015 +0100 @@ -25,9 +25,6 @@ }, 'statusgrid button[action=add]': { click: this.add - }, - 'statusgrid button[action=delete]': { - click: this.remove } }); }, @@ -87,43 +84,6 @@ button.up('statusgrid').rowEditing.startEdit(lastrow, 1); }, - /** - * A row can be removed from the grid with the remove - * function. It asks the user for confirmation - * If the removal was confirmed, it reloads the parent window on success, - * on failure, an error message is shown. - */ - remove: function(button) { - var grid = button.up('grid'); - var selection = grid.getView().getSelectionModel().getSelection()[0]; - Ext.MessageBox.confirm('Messwert löschen', 'Sind Sie sicher?', function(btn) { - if (btn === 'yes') { - selection.destroy({ - success: function() { - button.up('window').initData(); - grid.initData(); - }, - failure: function(request, response) { - var json = response.request.scope.reader.jsonData; - if (json) { - if (json.message){ - Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title') - +' #'+json.message, - Lada.getApplication().bundle.getMsg(json.message)); - } else { - Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'), - Lada.getApplication().bundle.getMsg('err.msg.generic.body')); - } - } else { - Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'), - Lada.getApplication().bundle.getMsg('err.msg.response.body')); - } - } - }); - } - }); - grid.down('button[action=delete]').disable(); - }, /** * When a row in a grid is selected, @@ -140,16 +100,6 @@ //retrieve the last record of the store var lastRecord = context.getStore().last() - //Check if remove is allowed - if (lastRecord == record && - readonlyWin == false && - readonlyRec == false) { - grid.down('button[action=delete]').enable(); - } - else { - grid.down('button[action=delete]').disable(); - } - //Check if edit is allowed if (lastRecord == record && diff -r 6a6f2c6fe8ee -r 5b86baa038bc app/view/grid/Status.js --- a/app/view/grid/Status.js Thu Nov 12 12:13:31 2015 +0100 +++ b/app/view/grid/Status.js Thu Nov 12 12:19:02 2015 +0100 @@ -64,10 +64,6 @@ action: 'add', probeId: this.probeId, parentId: this.parentId - }, { - text: 'Löschen', - icon: 'resources/img/list-remove.png', - action: 'delete' }] }]; this.columns = [{ @@ -153,16 +149,6 @@ }, sortable: false, }]; - this.listeners = { - select: { - fn: this.activateRemoveButton, - scope: this - }, - deselect: { - fn: this.deactivateRemoveButton, - scope: this - } - }; this.initData(); this.callParent(arguments); this.setReadOnly(true); //Grid is always initialised as RO @@ -188,7 +174,6 @@ if (this.getPlugin('rowedit')){ this.getPlugin('rowedit').disable(); } - this.down('button[action=delete]').disable(); this.down('button[action=add]').disable(); }else{ //Writable @@ -198,25 +183,5 @@ //this.down('button[action=delete]').enable(); this.down('button[action=add]').enable(); } - }, - /** - * Activate the "Remove Button" - */ - activateRemoveButton: function(selection, record) { - var grid = this; - //only enable the remove buttone, when the grid is editable. - if (! grid.readOnly) { - grid.down('button[action=delete]').enable(); - } - }, - /** - * Deactivate the "Remove Button" - */ - deactivateRemoveButton: function(selection, record) { - var grid = this; - //only enable the remove buttone, when the grid is editable. - if (! grid.readOnly) { - grid.down('button[action=delete]').disable(); - } } });