Skip to content

Commit

Permalink
fix(tree-base): grouping showing duplicate rows
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrum committed Nov 5, 2020
1 parent bc72131 commit 685d3c7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/tree-base/src/js/tree-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,7 @@
*/
createTree: function( grid, renderableRows ) {
var currentLevel = -1,
parentsCache = {},
parents = [],
currentState;

Expand Down Expand Up @@ -1116,6 +1117,17 @@
}
}

// If row header as parent exists in parentsCache
if (
typeof row.treeLevel !== 'undefined' &&
row.treeLevel !== null &&
row.treeLevel >= 0 &&
parentsCache.hasOwnProperty(row.uid)
) {
parents.push(parentsCache[row.uid]);
return
}

// aggregate if this is a leaf node
if ( ( typeof(row.treeLevel) === 'undefined' || row.treeLevel === null || row.treeLevel < 0 ) && row.visible ) {
service.aggregate( grid, row, parents );
Expand All @@ -1125,6 +1137,9 @@
service.addOrUseNode(grid, row, parents, aggregations);

if ( typeof(row.treeLevel) !== 'undefined' && row.treeLevel !== null && row.treeLevel >= 0 ) {
if (!parentsCache.hasOwnProperty(row.uid)) {
parentsCache[row.uid] = row;
}
parents.push(row);
currentLevel++;
currentState = service.setCurrentState(parents);
Expand Down

0 comments on commit 685d3c7

Please sign in to comment.