annotate app/override/RowEditor.js @ 1126:f1d234a7adc7

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

http://lada.wald.intevation.org