Skip to content

Commit

Permalink
Patch the add-on to fix the vaadin-grid issue: vaadin/vaadin-grid#2055
Browse files Browse the repository at this point in the history
  • Loading branch information
jcgueriaud1 committed Oct 14, 2020
1 parent fa90fdb commit 4015d43
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,21 @@ customElements.whenDefined("vaadin-grid").then(() => {
/** workaround when the expanded node opens children the index is outside the grid size **/
if (rowNumber > this._effectiveSize) {
const that = this;
setTimeout( () => that.scrollToIndex(rowNumber), 200);
setTimeout( () => {
that.scrollToIndex(rowNumber);
that._startToFocus(rowNumber, cellNumber);
}, 200);
} else {
this._startToFocus(rowNumber, cellNumber);
}
/** End of workaround **/
};

Grid.prototype._startToFocus = function (rowNumber, cellNumber) {
this._rowNumberToFocus = rowNumber;
this._cellNumberToFocus = cellNumber;
const row = Array.from(this.$.items.children).filter(
(child) => child.index === rowNumber
(child) => child.index === rowNumber
)[0];
// if row is already
if (row) {
Expand All @@ -26,7 +34,7 @@ customElements.whenDefined("vaadin-grid").then(() => {
throw "index out of bound";
}
}
};
}

Grid.prototype._focus = function () {
const rowNumber = this._rowNumberToFocus;
Expand Down

0 comments on commit 4015d43

Please # to comment.