From b6c7a22367689516e7dbe7d97679072362b7247a Mon Sep 17 00:00:00 2001 From: mertsincan Date: Mon, 1 Mar 2021 14:26:01 +0300 Subject: [PATCH] Refactor #1832 - For TreeTable --- src/components/treetable/TreeTableBody.js | 14 +++++++------- src/components/treetable/TreeTableRow.js | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/treetable/TreeTableBody.js b/src/components/treetable/TreeTableBody.js index a38d3be5f8..05918e3611 100644 --- a/src/components/treetable/TreeTableBody.js +++ b/src/components/treetable/TreeTableBody.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { TreeTableRow } from './TreeTableRow'; +import { TreeTableRow } from './TreeTableRow'; export class TreeTableBody extends Component { @@ -60,10 +60,10 @@ export class TreeTableBody extends Component { onContextMenu: PropTypes.func } - createRow(node) { + createRow(node, index) { return ( - this.createRow(node)); - } + return this.props.value.map((node, index) => this.createRow(node, index)); + } } renderEmptyMessage() { @@ -118,4 +118,4 @@ export class TreeTableBody extends Component { ); } -} \ No newline at end of file +} diff --git a/src/components/treetable/TreeTableRow.js b/src/components/treetable/TreeTableRow.js index 30b23d26ec..7ec6777026 100644 --- a/src/components/treetable/TreeTableRow.js +++ b/src/components/treetable/TreeTableRow.js @@ -501,7 +501,7 @@ export class TreeTableRow extends Component { } return ( - + {toggler} {checkbox} @@ -510,9 +510,9 @@ export class TreeTableRow extends Component { renderChildren() { if (this.isExpanded() && this.props.node.children) { - return this.props.node.children.map(childNode => { + return this.props.node.children.map((childNode, index) => { return ( -