comparison app/override/RowEditor.js @ 570:1f6a22107c8c

Added override for RowEditor.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 10 Mar 2015 12:09:50 +0100
parents
children
comparison
equal deleted inserted replaced
561:ea2c35cd9c19 570:1f6a22107c8c
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
2 * Software engineering by Intevation GmbH
3 *
4 * This file is Free Software under the GNU GPL (v>=3)
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
6 * the documentation coming with IMIS-Labordaten-Application for details.
7 */
8
9 Ext.define('Lada.override.RowEditor', {
10 override: 'Ext.grid.RowEditor',
11
12 addFieldsForColumn: function(column, initial) {
13 var me = this,
14 i,
15 length, field;
16
17 if (Ext.isArray(column)) {
18 for (i = 0, length = column.length; i < length; i++) {
19 me.addFieldsForColumn(column[i], initial);
20 }
21 return;
22 }
23
24 if (column.getEditor) {
25 // Get a default display field if necessary
26 field = column.getEditor(null, {
27 xtype: 'displayfield',
28 // Override Field's implementation so that the default display fields will not return values. This is done because
29 // the display field will pick up column renderers from the grid.
30 getModelData: function() {
31 return null;
32 }
33 });
34 if (column.align === 'right') {
35 field.fieldStyle = 'text-align:right';
36 }
37
38 if (column.xtype === 'actioncolumn') {
39 field.fieldCls += ' ' + Ext.baseCSSPrefix + 'form-action-col-field'
40 }
41
42 if (me.isVisible() && me.context) {
43 if (field.is('displayfield')) {
44 me.renderColumnData(field, me.context.record, column);
45 }
46 else {
47 field.suspendEvents();
48 field.setValue(me.context.record.get(column.dataIndex));
49 field.resumeEvents();
50 }
51 }
52 if (column.hidden) {
53 me.onColumnHide(column);
54 } else if (column.rendered && !initial) {
55 // Setting after initial render
56 me.onColumnShow(column);
57 }
58 }
59 me.mon(field, 'change', me.onFieldChange, me);
60 }
61 });

http://lada.wald.intevation.org