changeset 1050:e0b5e64928c9 stammdatengrids

Use rowediting plugin for orte grid.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 01 Mar 2016 13:16:10 +0100
parents 1bd4c0709bd6
children 981339d774b8 e8453adf5dbe
files app/controller/Ort.js app/view/grid/Orte.js app/view/panel/Ort.js app/view/window/Ortszuordnung.js
diffstat 4 files changed, 20 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/Ort.js	Tue Mar 01 11:50:39 2016 +0100
+++ b/app/controller/Ort.js	Tue Mar 01 13:16:10 2016 +0100
@@ -103,17 +103,20 @@
      * Enables/Disables a set of buttons
      **/
     buttonToggle: function(enabled, panel) {
-        if (!enabled) {
+        if (!enabled &&
+            panel.down('button[action=delete]')) {
             panel.down('button[action=delete]').disable();
         }
         else {
-            if (!panel.down('ortstammdatengrid').getPlugin('rowedit').editing) {
+            if (panel.down('ortstammdatengrid').getPlugin('rowedit') &&
+                !panel.down('ortstammdatengrid').getPlugin('rowedit').editing &&
+                panel.down('button[action=delete]')) {
             //only enable buttons, when grid is not beeing edited
                 panel.down('button[action=delete]').enable();
             }
             //else turn them off again!
             else {
-                this.buttonToggle(false, panel);
+                panel.down('button[action=delete]').disable();
             }
         }
     }
--- a/app/view/grid/Orte.js	Tue Mar 01 11:50:39 2016 +0100
+++ b/app/view/grid/Orte.js	Tue Mar 01 13:16:10 2016 +0100
@@ -26,18 +26,21 @@
     errors: null,
     readOnly: true,
     allowDeselect: true,
+    editableGrid: true,
 
     initComponent: function() {
         var i18n = Lada.getApplication().bundle;
         this.emptyText = i18n.getMsg('orte.emptyGrid');
 
-        this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
-            clicksToMoveEditor: 1,
-            autoCancel: false,
-            disabled: false,
-            pluginId: 'rowedit'
-        });
-        this.plugins = [this.rowEditing];
+        if (this.editableGrid) {
+            this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
+                clicksToMoveEditor: 1,
+                autoCancel: false,
+                disabled: false,
+                pluginId: 'rowedit'
+            });
+            this.plugins = [this.rowEditing];
+        }
 
         this.columns = [{
             header: i18n.getMsg('orte.ortId'),
--- a/app/view/panel/Ort.js	Tue Mar 01 11:50:39 2016 +0100
+++ b/app/view/panel/Ort.js	Tue Mar 01 13:16:10 2016 +0100
@@ -15,6 +15,8 @@
     },
     toolbarPos: 'top',
 
+    editableGrid: true,
+
     initComponent: function() {
         var i18n = Lada.getApplication().bundle;
 
@@ -68,6 +70,7 @@
         this.items = [{
             xtype: 'ortstammdatengrid',
             width: '60%',
+            editableGrid: this.editableGrid,
             collapsible: true,
             region: 'east'
         }, {
--- a/app/view/window/Ortszuordnung.js	Tue Mar 01 11:50:39 2016 +0100
+++ b/app/view/window/Ortszuordnung.js	Tue Mar 01 13:16:10 2016 +0100
@@ -88,6 +88,7 @@
             margin: 5
         }, {
             xtype: 'ortpanel',
+            editableGrid: false,
             flex: 1,
             toolbarPos: 'bottom',
             margin: 5

http://lada.wald.intevation.org