This commit is contained in:
AllenFang 2019-07-21 16:52:28 +08:00
parent d7e1f1dfd0
commit db22bb9adb
3 changed files with 5 additions and 4 deletions

View File

@ -26,12 +26,13 @@ Specify the content of expand row, `react-bootstrap-table2` will pass a row obje
#### values #### values
* **row** * **row**
* **rowIndex**
#### examples #### examples
```js ```js
const expandRow = { const expandRow = {
renderer: row => ( renderer: (row, rowIndex) => (
<div> <div>
<p>{ `This Expand row is belong to rowKey ${row.id}` }</p> <p>{ `This Expand row is belong to rowKey ${row.id}` }</p>
<p>You can render anything here, also you can add additional data on every row object</p> <p>You can render anything here, also you can add additional data on every row object</p>

View File

@ -18,9 +18,9 @@ const columns = [{
}]; }];
const expandRow = { const expandRow = {
renderer: row => ( renderer: (row, rowIndex) => (
<div> <div>
<p>{ `This Expand row is belong to rowKey ${row.id}` }</p> <p>{ `This Expand row is belong to rowKey ${row.id} and index: ${rowIndex}` }</p>
<p>You can render anything here, also you can add additional data on every row object</p> <p>You can render anything here, also you can add additional data on every row object</p>
<p>expandRow.renderer callback will pass the origin row object to you</p> <p>expandRow.renderer callback will pass the origin row object to you</p>
</div> </div>

View File

@ -34,7 +34,7 @@ export default (Component) => {
expanded={ expanded } expanded={ expanded }
onClosed={ () => expandRow.onClosed(key) } onClosed={ () => expandRow.onClosed(key) }
> >
{ expandRow.renderer(props.row) } { expandRow.renderer(props.row, props.rowIndex) }
</ExpandRow> : null </ExpandRow> : null
]; ];
}; };