[Lada-commits] [PATCH 2 of 2] Use rowediting plugin for orte grid

Wald Commits scm-commit at wald.intevation.org
Tue Mar 1 13:16:20 CET 2016


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1456834570 -3600
# Branch stammdatengrids
# Node ID e0b5e64928c95cdf8baf7379752642dd9621b79d
# Parent  1bd4c0709bd6d502ca5539fd9234a7be541192ac
Use rowediting plugin for orte grid.

diff -r 1bd4c0709bd6 -r e0b5e64928c9 app/controller/Ort.js
--- 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();
             }
         }
     }
diff -r 1bd4c0709bd6 -r e0b5e64928c9 app/view/grid/Orte.js
--- 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'),
diff -r 1bd4c0709bd6 -r e0b5e64928c9 app/view/panel/Ort.js
--- 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'
         }, {
diff -r 1bd4c0709bd6 -r e0b5e64928c9 app/view/window/Ortszuordnung.js
--- 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


More information about the Lada-commits mailing list