Created
April 29, 2017 12:30
-
-
Save AllenFang/865a791dd874c57a1766f4bee97d11aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SelectBgColorDynamicTable extends React.Component { | |
render() { | |
const selectRowProp = { | |
mode: 'checkbox', | |
bgColor: function(row, isSelect) { | |
if (isSelect) { | |
const { id } = row; | |
if (id < 2) return 'blue'; | |
else if (id < 4) return 'red'; | |
else return 'yellow'; | |
} | |
return null; | |
} | |
}; | |
return ( | |
<BootstrapTable data={ products } selectRow={ selectRowProp }> | |
<TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn> | |
<TableHeaderColumn dataField='name'>Product Name</TableHeaderColumn> | |
<TableHeaderColumn dataField='price'>Product Price</TableHeaderColumn> | |
</BootstrapTable> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment