[Lada-commits] [PATCH 1 of 5] Added override for RowEditor

Wald Commits scm-commit at wald.intevation.org
Tue Mar 10 14:32:11 CET 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1425985790 -3600
# Node ID 1f6a22107c8c13d7fcd4134c3b6431568e83d89e
# Parent  ea2c35cd9c196e481be6b70f6ee4601162f2f408
Added override for RowEditor.

diff -r ea2c35cd9c19 -r 1f6a22107c8c app.js
--- a/app.js	Mon Mar 09 11:55:51 2015 +0100
+++ b/app.js	Tue Mar 10 12:09:50 2015 +0100
@@ -27,6 +27,7 @@
     // found on https://github.com/elmasse/Ext.i18n.Bundle
     requires: [
         'Lada.override.Table',
+        'Lada.override.RowEditor',
         'Ext.i18n.Bundle',
         'Ext.layout.container.Column',
         'Lada.store.Datenbasis',
diff -r ea2c35cd9c19 -r 1f6a22107c8c app/override/RowEditor.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/override/RowEditor.js	Tue Mar 10 12:09:50 2015 +0100
@@ -0,0 +1,61 @@
+/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU GPL (v>=3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out
+ * the documentation coming with IMIS-Labordaten-Application for details.
+ */
+
+Ext.define('Lada.override.RowEditor', {
+    override: 'Ext.grid.RowEditor',
+
+    addFieldsForColumn: function(column, initial) {
+        var me = this,
+            i,
+            length, field;
+
+        if (Ext.isArray(column)) {
+            for (i = 0, length = column.length; i < length; i++) {
+                me.addFieldsForColumn(column[i], initial);
+            }
+            return;
+        }
+
+        if (column.getEditor) {
+            // Get a default display field if necessary
+            field = column.getEditor(null, {
+                xtype: 'displayfield',
+                // Override Field's implementation so that the default display fields will not return values. This is done because
+                // the display field will pick up column renderers from the grid.
+                getModelData: function() {
+                    return null;
+                }
+            });
+            if (column.align === 'right') {
+                field.fieldStyle = 'text-align:right';
+            }
+
+            if (column.xtype === 'actioncolumn') {
+                field.fieldCls += ' ' + Ext.baseCSSPrefix + 'form-action-col-field'
+            }
+
+            if (me.isVisible() && me.context) {
+                if (field.is('displayfield')) {
+                    me.renderColumnData(field, me.context.record, column);
+                }
+                else {
+                    field.suspendEvents();
+                    field.setValue(me.context.record.get(column.dataIndex));
+                    field.resumeEvents();
+                }
+            }
+            if (column.hidden) {
+                me.onColumnHide(column);
+            } else if (column.rendered && !initial) {
+                // Setting after initial render
+                me.onColumnShow(column);
+            }
+        }
+        me.mon(field, 'change', me.onFieldChange, me);
+    }
+});


More information about the Lada-commits mailing list