mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2025-10-16 11:55:39 +00:00
add expandable for expandColumnRenderer
This commit is contained in:
parent
24ab58a464
commit
e0163625d4
@ -92,15 +92,16 @@ const expandRow = {
|
||||
```
|
||||
|
||||
### <a name='expandColumnRenderer'>expandRow.expandColumnRenderer - [Function]</a>
|
||||
Provide a callback function which allow you to custom the expand indicator. This callback only have one argument which is an object and contain two properties:
|
||||
* `expanded`: Indicate if current row is expanded or not
|
||||
Provide a callback function which allow you to custom the expand indicator. This callback only have one argument which is an object and contain these properties:
|
||||
* `expanded`: If current row is expanded or not
|
||||
* `rowKey`: Current row key
|
||||
* `expandable`: If currnet row is expandable or not
|
||||
|
||||
|
||||
```js
|
||||
const expandRow = {
|
||||
renderer: (row) => ...
|
||||
expandColumnRenderer: ({ expanded, rowKey }) => (
|
||||
expandColumnRenderer: ({ expanded, rowKey, expandable }) => (
|
||||
// ....
|
||||
)
|
||||
};
|
||||
|
||||
@ -34,7 +34,7 @@ const expandRow = {
|
||||
}
|
||||
return <b>+</b>;
|
||||
},
|
||||
expandColumnRenderer: ({ expanded, rowKey }) => {
|
||||
expandColumnRenderer: ({ expanded, rowKey, expandable }) => {
|
||||
if (expanded) {
|
||||
return (
|
||||
<b>-</b>
|
||||
|
||||
@ -47,6 +47,7 @@ export default class ExpandCell extends Component {
|
||||
<td onClick={ this.handleClick } { ...attrs }>
|
||||
{
|
||||
expandColumnRenderer ? expandColumnRenderer({
|
||||
expandable,
|
||||
expanded,
|
||||
rowKey
|
||||
}) : (expandable ? (expanded ? '(-)' : '(+)') : '')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user