changeset 964:5b86baa038bc

removed delete button for messung-status
author Dustin Demuth <dustin@intevation.de>
date Thu, 12 Nov 2015 12:19:02 +0100
parents 6a6f2c6fe8ee
children a2c2039bb5d9
files app/controller/grid/Status.js app/view/grid/Status.js
diffstat 2 files changed, 0 insertions(+), 85 deletions(-) [+]
line wrap: on
line diff
--- 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 &&
--- 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();
-        }
     }
 });

http://lada.wald.intevation.org