]> git.proxmox.com Git - extjs.git/blob - extjs/classic/classic/src/grid/locking/RowSynchronizer.js
add extjs 6.0.1 sources
[extjs.git] / extjs / classic / classic / src / grid / locking / RowSynchronizer.js
1 /**
2 * @private
3 */
4 Ext.define('Ext.grid.locking.RowSynchronizer', {
5 constructor: function (view, rowEl) {
6 var me = this,
7 rowTpl;
8
9 me.view = view;
10 me.rowEl = rowEl;
11 me.els = {};
12
13 me.add('data', view.rowSelector);
14
15 for (rowTpl = view.rowTpl; rowTpl; rowTpl = rowTpl.nextTpl) {
16 if (rowTpl.beginRowSync) {
17 rowTpl.beginRowSync(me);
18 }
19 }
20 },
21
22 add: function (name, selector) {
23 var el = Ext.fly(this.rowEl).down(selector, true);
24
25 if (el) {
26 this.els[name] = {
27 el: el
28 };
29 }
30 },
31
32 finish: function (other) {
33 var me = this,
34 els = me.els,
35 otherEls = other.els,
36 otherEl,
37 growth = 0,
38 otherGrowth = 0,
39 delta, name, otherHeight;
40
41 for (name in els) {
42 otherEl = otherEls[name];
43
44 // Partnet RowSynchronizer may not have the element.
45 // For example, group summary may not be wanted in locking side.
46 otherHeight = otherEl ? otherEl.height : 0;
47 delta = otherHeight - els[name].height;
48
49 if (delta > 0) {
50 growth += delta;
51 Ext.fly(els[name].el).setHeight(otherHeight);
52 } else {
53 otherGrowth -= delta;
54 }
55 }
56
57 // Compare the growth to both rows and see if this row is lacking.
58 otherHeight = other.rowHeight + otherGrowth;
59
60 //<feature legacyBrowser>
61 // IE9 uses content box sizing on table, so height must not include border
62 if (Ext.isIE9 && me.view.ownerGrid.rowLines) {
63 otherHeight--;
64 }
65 //</feature>
66
67 if (me.rowHeight + growth < otherHeight) {
68 Ext.fly(me.rowEl).setHeight(otherHeight);
69 }
70 },
71
72 measure: function () {
73 var me = this,
74 els = me.els,
75 name;
76
77 me.rowHeight = me.rowEl.offsetHeight;
78
79 for (name in els) {
80 els[name].height = els[name].el.offsetHeight;
81 }
82 },
83
84 reset: function () {
85 var els = this.els,
86 name;
87
88 this.rowEl.style.height = '';
89
90 for (name in els) {
91 els[name].el.style.height = '';
92 }
93 }
94 });