Skip to content

Commit

Permalink
fix: pass both tree parent nodes and children nodes when exporting
Browse files Browse the repository at this point in the history
Fix export all data to excel with treeview bug. Example: http://plnkr.co/edit/hFPAO6W3EW8nlzt2

fix #7127, fix #6819
  • Loading branch information
alancqueiroz authored and Marcelo Portugal committed Oct 24, 2020
1 parent 158fd2d commit c536b59
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions packages/exporter/src/js/exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -952,21 +952,17 @@
* recurse down into the children to get to the raw data element
* which is a row without children (a leaf).
* @param {Node} aNode the tree node on the grid
* @returns {Array} an array of leaf nodes
* @returns {Array} an array with all child nodes from aNode
*/
getRowsFromNode: function(aNode) {
var rows = [];
for (var i = 0; i<aNode.children.length; i++) {
if (aNode.children[i].children && aNode.children[i].children.length === 0) {
rows.push(aNode.children[i]);
} else {
var nodeRows = this.getRowsFromNode(aNode.children[i]);
rows = rows.concat(nodeRows);
}
var rows = [aNode];
if (aNode.children && aNode.children.length > 0) {
for (var i = 0; i < aNode.children.length; i++) {
rows = rows.concat(this.getRowsFromNode(aNode.children[i]));
}
}
return rows;
},

/**
* @ngdoc function
* @name getDataSorted
Expand Down

0 comments on commit c536b59

Please sign in to comment.