From 7fca9b8ff4a846b2ba901be7e950f6ca5ef84db7 Mon Sep 17 00:00:00 2001 From: Leonard Date: Mon, 5 Jul 2021 11:22:13 +0200 Subject: [PATCH] Allow injecting additional thead rows before and after the generated header row. (Valid tables can have a multiple tbody elements but only a single thead and tfoot. Therefore additional rows need to be injected into the exisiting Header component.) --- .../react-bootstrap-table2/src/bootstrap-table.js | 8 +++++++- packages/react-bootstrap-table2/src/header.js | 15 +++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/react-bootstrap-table2/src/bootstrap-table.js b/packages/react-bootstrap-table2/src/bootstrap-table.js index 21d55a36d..d42073360 100644 --- a/packages/react-bootstrap-table2/src/bootstrap-table.js +++ b/packages/react-bootstrap-table2/src/bootstrap-table.js @@ -91,6 +91,7 @@ class BootstrapTable extends PropsBaseResolver(Component) {
{ tableCaption } + {this.props.preHeader}
+ {this.props.postHeader} {hasFilters && filterPosition !== Const.FILTERS_POSITION_INLINE && ( { onExternalFilter, filterPosition, globalSortCaret, - wrapperClasses + wrapperClasses, + preHeaderRow, + postHeaderRow } = props; let SelectionHeaderCellComp = () => null; @@ -82,9 +84,11 @@ const Header = (props) => { return (
+ {preHeaderRow} { childrens } + {postHeaderRow} ); }; @@ -106,7 +110,14 @@ Header.propTypes = { Const.FILTERS_POSITION_TOP, Const.FILTERS_POSITION_INLINE, Const.FILTERS_POSITION_BOTTOM - ]) + ]), + preHeaderRow: PropTypes.node, + postHeaderRow: PropTypes.node +}; + +Header.defaultProps = { + preHeaderRow: null, + postHeaderRow: null }; export default Header;