Skip to content

Instantly share code, notes, and snippets.

@prajapati-parth
Forked from AllenFang/tr-class-function-table.jsx
Last active September 27, 2017 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prajapati-parth/cad382dd876183c2507a161397e515cb to your computer and use it in GitHub Desktop.
Save prajapati-parth/cad382dd876183c2507a161397e515cb to your computer and use it in GitHub Desktop.
function rowClassNameFormat(row, rowIdx) {
// row is whole row object
// rowIdx is index of row
return rowIdx % 2 === 0 ? 'td-column-function-even-example' : 'td-column-function-odd-example';
}
class TrClassStringTable extends React.Component {
render() {
return (
<BootstrapTable data={ products } trClassName={this.rowClassNameFormat}>
<TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn>
<TableHeaderColumn dataField='name'>Product Name</TableHeaderColumn>
<TableHeaderColumn dataField='price'>Product Price</TableHeaderColumn>
</BootstrapTable>
);
}
}
@AllenFang
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment