import React from 'react'; import BootstrapTable from 'react-bootstrap-table-next'; import Code from 'components/common/code-block'; import { productsExpandRowsGenerator } from 'utils/common'; const products = productsExpandRowsGenerator(); const columns = [{ dataField: 'id', text: 'Product ID' }, { dataField: 'name', text: 'Product Name' }, { dataField: 'price', text: 'Product Price' }]; const expandRow1 = { className: 'expanding-foo', renderer: row => (

{ `This Expand row is belong to rowKey ${row.id}` }

You can render anything here, also you can add additional data on every row object

expandRow.renderer callback will pass the origin row object to you

) }; const expandRow2 = { className: (isExpanded, row, rowIndex) => { if (rowIndex > 2) return 'expanding-foo'; return 'expanding-bar'; }, renderer: row => (

{ `This Expand row is belong to rowKey ${row.id}` }

You can render anything here, also you can add additional data on every row object

expandRow.renderer callback will pass the origin row object to you

) }; const sourceCode1 = `\ import BootstrapTable from 'react-bootstrap-table-next'; const columns = // omit... const expandRow = { className: 'expanding-foo', renderer: row => (
.....
) }; `; const sourceCode2 = `\ import BootstrapTable from 'react-bootstrap-table-next'; const columns = // omit... const expandRow = { className: (isExpanded, row, rowIndex) => { if (rowIndex > 2) return 'expanding-foo'; return 'expanding-bar'; }, renderer: row => (
...
) }; `; export default () => (
{ sourceCode1 } { sourceCode2 }
);