Skip to content

Commit 7435c53

Browse files
committed
add props withoutRowNum && renderRowNum
1 parent 9e778e6 commit 7435c53

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

build/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@ export class OutTable extends Component {
1616
<table className={this.props.tableClassName} >
1717
<tbody>
1818
<tr>
19-
{this.props.withZeroColumn && <th className={this.props.tableHeaderRowClass || ""}></th>}
19+
{this.props.withZeroColumn && !this.props.withoutRowNum && <th className={this.props.tableHeaderRowClass || ""}></th>}
2020
{
2121
this.props.columns.map((c) =>
2222
<th key={c.key} className={c.key === -1 ? this.props.tableHeaderRowClass : ""}>{c.key === -1 ? "" : c.name}</th>
2323
)
2424

2525
}
2626
</tr>
27-
{this.props.data.map((r,i) => <tr key={i}><td key={i} className={this.props.tableHeaderRowClass}>{i}</td>
27+
{this.props.data.map((r,i) => <tr key={i}>
28+
{!this.props.withoutRowNum && <td key={i} className={this.props.tableHeaderRowClass}>{this.props.renderRowNum?this.props.renderRowNum(r,i):i}</td>}
2829
{this.props.columns.map(c => <td key={c.key}>{ r[c.key] }</td>)}
2930
</tr>)}
3031
</tbody>

0 commit comments

Comments
 (0)