SitePen / dgrid

A lightweight, mobile-ready, data-driven, modular grid widget designed for use with dstore
http://dgrid.io/
Other
628 stars 298 forks source link

dgrid Tree._expandWhenInDom generating exception #1415

Closed jstolte closed 6 years ago

jstolte commented 6 years ago

dgrid v1.2.1, dojo v1.13.0, dstore v1.1.1 Tree._expandWhenInDom has the following snippet at line 262...

var expandPromise = this.expand( rowElement, true, true, options.scrollingUp);
if (dfd) {
    expandPromise.then(function () {
        dfd.resolve();
    });
}

Tree.expand() starts off with the following...

if (!this._treeColumn) {
    return;
}

In my case, this._treeColumn is undefined, so this.expand() returns undefined where Tree._expandWhenInDom() is expecting a promise to be returned.

All I did to the project was update the dgrid component from 0.4.4 to 1.2.1. The dgrid instance in 0.4.4 was working fine. 1.2.1 has the problem mentioned above. I did not change anything in how the grid is being created, populated with data, and used.

The initial data populating the dstore instance does not have any child elements associated with any of the top level or parent row items... so really, there are no "rows" to "expand/collapse". No idea if that is a contributing issue to the problem or not.

For what it is worh, my naive temporary solution was to wrap the result from the call to this.expand(...) in a call to when(...). i.e. I changed line 264 of Tree.js to

when(expandPromise).then(function () {
    ...
});

image

edhager commented 6 years ago

Thanks @jstolte!

dgrid/Tree#expand should always return a promise. I fixed it.