annotate app/view/plugin/GridRowExpander.js @ 1139:143ab8fa13dc

Added 'readonly' data field.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 26 May 2016 14:04:37 +0200
parents 4a55e665f2d1
children
rev   line source
1110
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 Ext.define('Lada.view.plugin.GridRowExpander', {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 extend: 'Ext.grid.plugin.RowExpander',
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 alias: 'plugin.gridrowexpander',
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 rowBodyTpl: '&nbsp;',
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 loadingMessage: '<div class="x-grid-rowbody-loading">Loading...</div>',
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 type: null,
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8 gridConfig: null,
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 constructor: function(config) {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 var me = this;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 var tpl = config.rowBodyTpl || me.rowBodyTpl;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 var cmps;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 me.type = config.gridType;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 me.gridConfig = config.gridConfig;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 me.callParent(arguments);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 cmps = me.cmps = new Ext.util.MixedCollection(null, function(o) {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 return o.recordId;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 });
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 cmps.on('remove', me.onCmpRemove, me);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 me.rowBodyTpl = new Ext.XTemplate(tpl);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 },
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 init: function(grid) {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 var me = this;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 var view = grid.getView();
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 view.processUIEvent = me.createProcessUIEvent(view.processUIEvent);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 me.callParent(arguments);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 },
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 destroy: function() {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 var cmps = this.cmps;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 cmps.removeAll();
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 this.callParent();
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 },
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 onCmpRemove: function(cmp) {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 cmp.destroy();
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 },
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 createProcessUIEvent: function(oldFn) {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 var grid = this.getCmp();
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 return function(e) {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 var me = this;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 var item = e.getTarget(me.dataRowSelector || me.itemSelector,
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 me.getTargetEl());
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 var row;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 var eGrid;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 row = Ext.fly(item);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 if (row) {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 eGrid = row.up('.x-grid'); // grid el of UI event
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 }
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 if (eGrid && eGrid.id !== grid.el.id) {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 if (e.type !== 'contextmenu' && e.type !== 'keydown') {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 e.stopEvent();
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 }
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 return null;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 }
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 return oldFn.apply(me, arguments);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 };
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 },
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 toggleRow: function(rowIdx) {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 var me = this;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 var rowNode = me.view.getNode(rowIdx);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 var row = Ext.get(rowNode);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 var nextBd = Ext.get(row).down(this.rowBodyTrSelector);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 var expandDiv = nextBd.down('div.x-grid-rowbody');
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 var record = me.view.getRecord(rowNode);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 if (row.hasCls(me.rowCollapsedCls)) {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 row.removeCls(me.rowCollapsedCls);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 nextBd.removeCls(me.rowBodyHiddenCls);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 me.recordsExpanded[record.internalId] = true;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 me.showCmp(expandDiv, record);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 me.view.fireEvent('expandbody', rowNode, record, nextBd.dom);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 }
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 else {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 row.addCls(me.rowCollapsedCls);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 nextBd.addCls(me.rowBodyHiddenCls);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 me.recordsExpanded[record.internalId] = false;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 me.collapseCmp(expandDiv, record);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 me.view.fireEvent('collapsebody', rowNode, record, nextBd.dom);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 }
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 },
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 createCmp: function(record, id, config) {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 var me = this;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102 var gridConfig = config.gridConfig;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
103 Ext.apply(gridConfig, {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 recordId: record.get('id'),
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105 cls: 'row-expander-grid'
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 });
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107 var grid = Ext.create(me.type, gridConfig);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
108
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
109 return grid;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
110 },
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
111
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
112 showCmp: function(row, record) {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113 var me = this;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114 var cmps = me.cmps;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
115 var id = record.getObservableId();
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
116 var idx = cmps.findIndex('recordId', id);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
117 var cmp = cmps.getAt(idx);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
118 var gridConfig = me.gridConfig;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 if (!cmp) {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
121 row.update(me.loadingMessage);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
122
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
123 cmp = me.cmps.add(me.createCmp(record, id, {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
124 gridConfig: gridConfig
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
125 }));
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
126 }
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
127 row.update('');
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
128 cmp.render(row);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
129 },
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
130
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
131 getInnerCmp: function(record) {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
132 return this.cmps.getByKey(
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
133 record.getObservableId()
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
134 );
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
135 },
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
136
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
137 collapseCmp: function(row, record) {
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
138 var me = this;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
139 var cmps = me.cmps;
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
140 var id = record.getObservableId();
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
141 var idx = cmps.findIndex('recordId', id);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
142 var cmp = cmps.getAt(idx);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
143
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
144 cmps.remove(cmp);
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145 cmp.destroy();
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
146 }
4a55e665f2d1 Added custom row expander for 'grid in grid' expandable rows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
147 });

http://lada.wald.intevation.org