add expandable for expandColumnRenderer

This commit is contained in:
AllenFang 2018-12-20 23:47:30 +08:00
parent 24ab58a464
commit e0163625d4
3 changed files with 6 additions and 4 deletions

View File

@ -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 }) => (
// ....
)
};

View File

@ -34,7 +34,7 @@ const expandRow = {
}
return <b>+</b>;
},
expandColumnRenderer: ({ expanded, rowKey }) => {
expandColumnRenderer: ({ expanded, rowKey, expandable }) => {
if (expanded) {
return (
<b>-</b>

View File

@ -47,6 +47,7 @@ export default class ExpandCell extends Component {
<td onClick={ this.handleClick } { ...attrs }>
{
expandColumnRenderer ? expandColumnRenderer({
expandable,
expanded,
rowKey
}) : (expandable ? (expanded ? '(-)' : '(+)') : '')