Skip to content

Commit b16b8e2

Browse files
Ivan KitanovIvan Kitanov
authored andcommitted
Modyfind the addition of rows so that no row is added more than once
1 parent 216d6de commit b16b8e2

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • samples/grids/tree-grid/row-drag-base/src

samples/grids/tree-grid/row-drag-base/src/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ export default function App() {
2323

2424
// Recursive function to add the row and its children
2525
function addRowAndChildren(row:EmployeesNestedTreeDataItem, newData:EmployeesNestedTreeDataItem[]) {
26+
if(newData.includes(row)){
27+
return;
28+
}
2629
newData.push(row);
2730
const children = employeesData.filter(emp => emp.ParentID === row.ID);
2831
children.forEach(child => addRowAndChildren(child, newData));

0 commit comments

Comments
 (0)