从自定义行组成 material table
Composing material table from custom rows
我想用专用组件将 table 中的每一行包装起来,这样它的结构就会像
<TableBody>
<MyRow/>
<MyRow/>
</TableBody>
而不是
<TableBody>
<TableRow/>
<TableRow/>
</TableBody>
但是,选择复选框会消失。
https://jsfiddle.net/uLed8p5u/
有什么解决方法的建议吗?
var MyRow = React.createClass({
render: function () {
return <TableRow {...this.props}>
{this.props.children[0]}
<TableRowColumn>2</TableRowColumn>
<TableRowColumn>Randal White</TableRowColumn>
<TableRowColumn>Unemployed</TableRowColumn>
</TableRow>
}
});
只需要像 TableBody 组件一样将 props 重新应用到子元素。
我想用专用组件将 table 中的每一行包装起来,这样它的结构就会像
<TableBody>
<MyRow/>
<MyRow/>
</TableBody>
而不是
<TableBody>
<TableRow/>
<TableRow/>
</TableBody>
但是,选择复选框会消失。
https://jsfiddle.net/uLed8p5u/
有什么解决方法的建议吗?
var MyRow = React.createClass({
render: function () {
return <TableRow {...this.props}>
{this.props.children[0]}
<TableRowColumn>2</TableRowColumn>
<TableRowColumn>Randal White</TableRowColumn>
<TableRowColumn>Unemployed</TableRowColumn>
</TableRow>
}
});
只需要像 TableBody 组件一样将 props 重新应用到子元素。