@@ -6,6 +6,7 @@ import PropTypes from 'prop-types';
66import cs from 'classnames' ;
77
88import Header from './header' ;
9+ import Filters from './filters' ;
910import Caption from './caption' ;
1011import Body from './body' ;
1112import Footer from './footer' ;
@@ -77,6 +78,8 @@ class BootstrapTable extends PropsBaseResolver(Component) {
7778 [ bootstrap4 ? 'table-sm' : 'table-condensed' ] : condensed
7879 } , classes ) ;
7980
81+ const hasFilters = columns . some ( col => col . filter || col . filterRenderer ) ;
82+
8083 const hasFooter = _ . filter ( columns , col => _ . has ( col , 'footer' ) ) . length > 0 ;
8184
8285 const tableCaption = ( caption && < Caption > { caption } </ Caption > ) ;
@@ -91,12 +94,20 @@ class BootstrapTable extends PropsBaseResolver(Component) {
9194 sortField = { this . props . sortField }
9295 sortOrder = { this . props . sortOrder }
9396 onSort = { this . props . onSort }
94- onFilter = { this . props . onFilter }
95- currFilters = { this . props . currFilters }
96- onExternalFilter = { this . props . onExternalFilter }
9797 selectRow = { selectRow }
9898 expandRow = { expandRow }
9999 />
100+ { hasFilters && (
101+ < Filters
102+ columns = { columns }
103+ className = { this . props . filtersClasses }
104+ onSort = { this . props . onSort }
105+ onFilter = { this . props . onFilter }
106+ currFilters = { this . props . currFilters }
107+ position = { this . props . filtersPosition }
108+ onExternalFilter = { this . props . onExternalFilter }
109+ />
110+ ) }
100111 < Body
101112 data = { this . getData ( ) }
102113 keyField = { keyField }
@@ -199,6 +210,11 @@ BootstrapTable.propTypes = {
199210 rowEvents : PropTypes . object ,
200211 rowClasses : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . func ] ) ,
201212 headerClasses : PropTypes . string ,
213+ filtersClasses : PropTypes . string ,
214+ filtersPosition : PropTypes . oneOf ( [
215+ Const . FILTERS_POSITION_TOP ,
216+ Const . FILTERS_POSITION_BOTTOM
217+ ] ) ,
202218 footerClasses : PropTypes . string ,
203219 defaultSorted : PropTypes . arrayOf ( PropTypes . shape ( {
204220 dataField : PropTypes . string . isRequired ,
0 commit comments