Skip to content

Commit

Permalink
Fix the problem with the preload node linked list not being properly …
Browse files Browse the repository at this point in the history
…built when refresh is called with keepScrollPosition set to true and there are expanded tree rows.
  • Loading branch information
edhager committed Oct 7, 2016
1 parent 26cae24 commit e1cbc84
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Tree.js
Expand Up @@ -229,7 +229,6 @@ define([

insertRow: function (object, container, beforeNode, i, options) {
options = options || {};
var grid = this;

var level = options.queryLevel = 'queryLevel' in options ? options.queryLevel :
'level' in container ? container.level : 0;
Expand All @@ -241,7 +240,7 @@ define([
expanded = this.shouldExpand(row, level, this._expanded[row.id]);

if (expanded) {
this.expand(rowElement, true, true, options.scrollingUp);
this._expandWhenInDom(rowElement, options);
}

if (expanded || (!this.collection.mayHaveChildren || this.collection.mayHaveChildren(object))) {
Expand All @@ -251,6 +250,17 @@ define([
return rowElement; // pass return value through
},

_expandWhenInDom: function (rowElement, options) {
// Expand a row after it has been inserted into the DOM. This is necessary because
// the OnDemandList code that manages the preload nodes needs the nodes to be in the DOM
// to create a correctly ordered linked list.
if (rowElement.offsetHeight) {
this.expand(rowElement, true, true, options.scrollingUp);
} else {
setTimeout(this._expandWhenInDom.bind(this, rowElement, options), 0);
}
},

_queueNodeForDeletion: function (node) {
this.inherited(arguments);

Expand Down

0 comments on commit e1cbc84

Please sign in to comment.