Skip to content

Commit 1bd17cc

Browse files
author
Tom Blauwendraat
committed
fixup! [FIX] sticky column bug, sometimes eclipsing editable fields
1 parent 539bf68 commit 1bd17cc

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

web_widget_x2many_2d_matrix_freeze/static/src/js/web_matrix_view_sticky.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ openerp.web_widget_x2many_2d_matrix_freeze = function (instance) {
3535
this.stickyHead.width(this.stickyTable.width());
3636

3737
// Set width of sticky table col
38-
this.stickyCol.find("tr:eq(0) th, tr:eq(0) td").each(function (i) {
39-
$(this)
40-
.add(self.stickyInsct.find("th,td").eq(i))
41-
.width(self.stickyTable.find("thead th, thead td").eq(i).width());
38+
var head_elms = self.stickyTable.find("thead th, thead td");
39+
this.stickyCol.find("tr").each(function(j) {
40+
$(this).find("th, td").slice(0, self.sticky_x).each(function (i) {
41+
$(this)
42+
.width(head_elms.eq(i).width());
43+
});
4244
});
4345
},
4446

@@ -167,7 +169,7 @@ openerp.web_widget_x2many_2d_matrix_freeze = function (instance) {
167169

168170
if (this.node.attrs.sticky && _table.length > 0 && _table.parent('.sticky-wrap').length == 0) {
169171

170-
var sticky_x = parseInt(this.node.attrs.sticky_x) || 1;
172+
this.sticky_x = parseInt(this.node.attrs.sticky_x) || 1;
171173

172174
// Clone <thead>
173175
var thead = _table.find("thead").clone(),
@@ -198,7 +200,6 @@ openerp.web_widget_x2many_2d_matrix_freeze = function (instance) {
198200
// Create shorthand for things
199201
this.sticky = true;
200202
this.view_manager = this.$el.parents(".oe_view_manager").first();
201-
console.log(this.view_manager);
202203
this.view_header = this.view_manager.find(".oe_view_manager_header");
203204
this.view_body = this.view_manager.find(".oe_view_manager_body");
204205
this.stickyTable = _table;
@@ -215,7 +216,7 @@ openerp.web_widget_x2many_2d_matrix_freeze = function (instance) {
215216
.each(function() {
216217
$(this)
217218
.find("td,th")
218-
.slice(sticky_x)
219+
.slice(self.sticky_x)
219220
.css("display", "none");
220221
});
221222
var margin = $(_table.find("thead th")[0]).css("height");

0 commit comments

Comments
 (0)