Skip to content

Commit 7fca9b8

Browse files
committed
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.)
1 parent ef22dc4 commit 7fca9b8

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

packages/react-bootstrap-table2/src/bootstrap-table.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ class BootstrapTable extends PropsBaseResolver(Component) {
9191
<div className={ tableWrapperClass }>
9292
<table id={ id } className={ tableClass }>
9393
{ tableCaption }
94+
{this.props.preHeader}
9495
<Header
9596
columns={ columns }
9697
className={ this.props.headerClasses }
@@ -105,7 +106,10 @@ class BootstrapTable extends PropsBaseResolver(Component) {
105106
selectRow={ selectRow }
106107
expandRow={ expandRow }
107108
filterPosition={ filterPosition }
109+
preHeaderRow={ this.props.preHeaderRow }
110+
postHeaderRow={ this.props.postHeaderRow }
108111
/>
112+
{this.props.postHeader}
109113
{hasFilters && filterPosition !== Const.FILTERS_POSITION_INLINE && (
110114
<Filters
111115
columns={ columns }
@@ -255,7 +259,9 @@ BootstrapTable.propTypes = {
255259
searchText: PropTypes.string,
256260
searchContext: PropTypes.func
257261
}),
258-
setDependencyModules: PropTypes.func
262+
setDependencyModules: PropTypes.func,
263+
preHeaderRow: PropTypes.node,
264+
postHeaderRow: PropTypes.node
259265
};
260266

261267
BootstrapTable.defaultProps = {

packages/react-bootstrap-table2/src/header.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ const Header = (props) => {
2323
onExternalFilter,
2424
filterPosition,
2525
globalSortCaret,
26-
wrapperClasses
26+
wrapperClasses,
27+
preHeaderRow,
28+
postHeaderRow
2729
} = props;
2830

2931
let SelectionHeaderCellComp = () => null;
@@ -82,9 +84,11 @@ const Header = (props) => {
8284

8385
return (
8486
<thead className={ wrapperClasses }>
87+
{preHeaderRow}
8588
<tr className={ className }>
8689
{ childrens }
8790
</tr>
91+
{postHeaderRow}
8892
</thead>
8993
);
9094
};
@@ -106,7 +110,14 @@ Header.propTypes = {
106110
Const.FILTERS_POSITION_TOP,
107111
Const.FILTERS_POSITION_INLINE,
108112
Const.FILTERS_POSITION_BOTTOM
109-
])
113+
]),
114+
preHeaderRow: PropTypes.node,
115+
postHeaderRow: PropTypes.node
116+
};
117+
118+
Header.defaultProps = {
119+
preHeaderRow: null,
120+
postHeaderRow: null
110121
};
111122

112123
export default Header;

0 commit comments

Comments
 (0)