Stan Kurilin
Stan Kurilin

Reputation: 15792

Composing material table from custom rows

I want to wrap each of my rows in table with dedicated component so that it would have structure like

<TableBody>
  <MyRow/>
  <MyRow/>
</TableBody>

instead of

<TableBody>
  <TableRow/>
  <TableRow/>
</TableBody>

However, after doing it selection checkbox disappears.

https://jsfiddle.net/uLed8p5u/

Any advices how that could be fixed?

Upvotes: 2

Views: 1872

Answers (1)

Jake Haller-Roby
Jake Haller-Roby

Reputation: 6427

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>
      }
});

Just needs to have the props re-applied to the child elements in the same way that the TableBody component does.

Upvotes: 2

Related Questions