mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2025-10-16 11:55:39 +00:00
row expandable already calculated from row expand consumer, just use it instead do the logic again
This commit is contained in:
parent
6e19368733
commit
24ab58a464
@ -10,7 +10,7 @@ export default class ExpandCell extends Component {
|
||||
static propTypes = {
|
||||
rowKey: PropTypes.any,
|
||||
expanded: PropTypes.bool.isRequired,
|
||||
nonExpandable: PropTypes.array.isRequired,
|
||||
expandable: PropTypes.bool.isRequired,
|
||||
onRowExpand: PropTypes.func.isRequired,
|
||||
expandColumnRenderer: PropTypes.func,
|
||||
rowIndex: PropTypes.number,
|
||||
@ -39,9 +39,8 @@ export default class ExpandCell extends Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { expanded, nonExpandable, expandColumnRenderer, tabIndex, rowKey } = this.props;
|
||||
const { expanded, expandable, expandColumnRenderer, tabIndex, rowKey } = this.props;
|
||||
const attrs = {};
|
||||
const isExpandable = !nonExpandable || !nonExpandable.includes(this.props.rowKey);
|
||||
if (tabIndex !== -1) attrs.tabIndex = tabIndex;
|
||||
|
||||
return (
|
||||
@ -50,7 +49,7 @@ export default class ExpandCell extends Component {
|
||||
expandColumnRenderer ? expandColumnRenderer({
|
||||
expanded,
|
||||
rowKey
|
||||
}) : (isExpandable ? (expanded ? '(-)' : '(+)') : '')
|
||||
}) : (expandable ? (expanded ? '(-)' : '(+)') : '')
|
||||
}
|
||||
</td>
|
||||
);
|
||||
|
||||
@ -31,6 +31,7 @@ export default class RowAggregator extends shouldUpdater(eventDelegater(React.Co
|
||||
if (
|
||||
this.props.selected !== nextProps.selected ||
|
||||
this.props.expanded !== nextProps.expanded ||
|
||||
this.props.expandable !== nextProps.expandable ||
|
||||
this.props.selectable !== nextProps.selectable ||
|
||||
this.shouldUpdatedBySelfProps(nextProps)
|
||||
) {
|
||||
@ -54,6 +55,7 @@ export default class RowAggregator extends shouldUpdater(eventDelegater(React.Co
|
||||
selectRow,
|
||||
expandRow,
|
||||
expanded,
|
||||
expandable,
|
||||
selected,
|
||||
selectable,
|
||||
visibleColumnSize,
|
||||
@ -84,6 +86,7 @@ export default class RowAggregator extends shouldUpdater(eventDelegater(React.Co
|
||||
rowKey={ key }
|
||||
rowIndex={ rowIndex }
|
||||
expanded={ expanded }
|
||||
expandable={ expandable }
|
||||
tabIndex={ tabIndexCell ? tabIndexStart++ : -1 }
|
||||
/>
|
||||
) : null
|
||||
|
||||
Loading…
Reference in New Issue
Block a user