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