From e0163625d40589c0777fe86e1175e12c8459005d Mon Sep 17 00:00:00 2001 From: AllenFang Date: Thu, 20 Dec 2018 23:47:30 +0800 Subject: [PATCH] add expandable for expandColumnRenderer --- docs/row-expand.md | 7 ++++--- .../examples/row-expand/custom-expand-column.js | 2 +- .../react-bootstrap-table2/src/row-expand/expand-cell.js | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/row-expand.md b/docs/row-expand.md index 5de4f7b..ce710de 100644 --- a/docs/row-expand.md +++ b/docs/row-expand.md @@ -92,15 +92,16 @@ const expandRow = { ``` ### expandRow.expandColumnRenderer - [Function] -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 }) => ( // .... ) }; diff --git a/packages/react-bootstrap-table2-example/examples/row-expand/custom-expand-column.js b/packages/react-bootstrap-table2-example/examples/row-expand/custom-expand-column.js index b1ed8c1..507bcf2 100644 --- a/packages/react-bootstrap-table2-example/examples/row-expand/custom-expand-column.js +++ b/packages/react-bootstrap-table2-example/examples/row-expand/custom-expand-column.js @@ -34,7 +34,7 @@ const expandRow = { } return +; }, - expandColumnRenderer: ({ expanded, rowKey }) => { + expandColumnRenderer: ({ expanded, rowKey, expandable }) => { if (expanded) { return ( - diff --git a/packages/react-bootstrap-table2/src/row-expand/expand-cell.js b/packages/react-bootstrap-table2/src/row-expand/expand-cell.js index dc7bf24..4b5903d 100644 --- a/packages/react-bootstrap-table2/src/row-expand/expand-cell.js +++ b/packages/react-bootstrap-table2/src/row-expand/expand-cell.js @@ -47,6 +47,7 @@ export default class ExpandCell extends Component { { expandColumnRenderer ? expandColumnRenderer({ + expandable, expanded, rowKey }) : (expandable ? (expanded ? '(-)' : '(+)') : '')