【发布时间】:2017-12-01 08:37:34
【问题描述】:
点击时如何突出显示表格中的一行?我尝试过使用onClick 函数,但我无法实现。
这是我用来将表格数据映射到td标签的函数。
displayData() {
let x;
if (this.props.data) {
x = this.props.data.map(item => (
<tr>
<td> {item.height} </td>
</tr>
));
}
return x;
}
这里我在渲染函数中调用了这个函数。
<Table id="tableId" >
<thead>
<tr>
<th> height </th>
</tr>
</thead>
<tbody> {this.displayData()} </tbody>
</Table>
【问题讨论】:
标签: javascript twitter-bootstrap reactjs