Skip to content

Commit

Permalink
Make columns offset generic for other cases
Browse files Browse the repository at this point in the history
  • Loading branch information
manolo committed Sep 28, 2016
1 parent 9262dc0 commit ac0a2bc
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions vaadin-grid-table-row.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,21 @@
},

_updateCells: function() {
// columns > cells means that there is an extra col for multiselection
var multiSel = this.columns.length > this.cells.length ? 1 : 0;
// Extra columns are used for multi-selection or hierarchy.
var extraColumns = this.columns.length > this.cells.length ? 1 : 0;

for (var i = 0, l = this.cells.length, colspan; i < l; i += colspan) {
var cell = this.cells[i];
colspan = cell.colspan || 1;
var width = this.columns[i + multiSel].width;
var flex = this.columns[i + multiSel].flex;
var width = this.columns[i + extraColumns].width;
var flex = this.columns[i + extraColumns].flex;

// Visit colspanned cells to hide then and increase width and flex of parent
// Visit colspanned cells to hide them, and increase parent width and flex.
for (var j = 1; j < colspan && i + j < l; j++) {
this.cells[i + j].style.display = 'none';
width = width + ' + ' + this.columns[i + multiSel + j].width;
flex += this.columns[i + multiSel + j].flex;

width = width + ' + ' + this.columns[i + extraColumns + j].width;
flex += this.columns[i + extraColumns + j].flex;
}

cell.style.flexBasis = 'calc(' + width + ')';
Expand Down

0 comments on commit ac0a2bc

Please sign in to comment.