Skip to content

Commit e668971

Browse files
committed
Merge branch 'issue-1130-pagination-page-size-dropdown' of https://github.com/JLoboRod/react-bootstrap-table into JLoboRod-issue-1130-pagination-page-size-dropdown
2 parents dfbf587 + 156559f commit e668971

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

src/pagination/PaginationList.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@ class PaginationList extends Component {
1010
constructor(props) {
1111
super(props);
1212
this.state = {
13-
open: this.props.open
13+
open: this.props.open,
14+
show: this.props.show
1415
};
1516
}
1617

1718
componentWillReceiveProps() {
1819
const { keepSizePerPageState } = this.props;
1920
if (!keepSizePerPageState) {
20-
this.setState({ open: false });
21+
this.setState({
22+
open: false,
23+
show: false
24+
});
2125
}
2226
}
2327

@@ -45,7 +49,12 @@ class PaginationList extends Component {
4549
page = parseInt(page, 10);
4650
}
4751

48-
if (keepSizePerPageState) { this.setState({ open: false }); }
52+
if (keepSizePerPageState) {
53+
this.setState({
54+
open: false,
55+
show: false
56+
});
57+
}
4958

5059
if (page !== currPage) {
5160
this.props.changePage(page, sizePerPage);
@@ -64,12 +73,16 @@ class PaginationList extends Component {
6473
this.props.onSizePerPageList(selectSize);
6574
}
6675
}
67-
this.setState({ open: false });
76+
this.setState({
77+
open: false,
78+
show: false
79+
});
6880
}
6981

7082
toggleDropDown = () => {
7183
this.setState({
72-
open: !this.state.open
84+
open: !this.state.open,
85+
show: !this.state.show
7386
});
7487
}
7588

@@ -149,6 +162,7 @@ class PaginationList extends Component {
149162
if (sizePerPageDropDown) {
150163
dropdown = sizePerPageDropDown({
151164
open: this.state.open,
165+
show: this.state.show,
152166
hideSizePerPage,
153167
currSizePerPage: String(sizePerPage),
154168
sizePerPageList,
@@ -182,6 +196,7 @@ class PaginationList extends Component {
182196
dropdown = (
183197
<SizePerPageDropDown
184198
open={ this.state.open }
199+
show={ this.state.show }
185200
hidden={ hideSizePerPage }
186201
currSizePerPage={ String(sizePerPageText) }
187202
options={ sizePerPageOptions }

src/pagination/SizePerPageDropDown.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class SizePerPageDropDown extends Component {
77
render() {
88
const {
99
open,
10+
show,
1011
hidden,
1112
onClick,
1213
options,
@@ -17,11 +18,12 @@ class SizePerPageDropDown extends Component {
1718
} = this.props;
1819

1920
const openClass = open ? 'open' : '';
21+
const showClass = show ? 'show' : '';
2022
const dropDownStyle = { visibility: hidden ? 'hidden' : 'visible' };
2123

2224
return (
2325
<span style={ dropDownStyle }
24-
className={ `${variation} ${openClass} ${className} ${sizePerPageDefaultClass}` }>
26+
className={ `${variation} ${openClass} ${showClass} ${className} ${sizePerPageDefaultClass}` }>
2527
<button className={ `btn ${btnContextual} dropdown-toggle` }
2628
id='pageDropDown' data-toggle='dropdown'
2729
aria-expanded={ open }
@@ -52,6 +54,7 @@ SizePerPageDropDown.propTypes = {
5254
};
5355
SizePerPageDropDown.defaultProps = {
5456
open: false,
57+
show: false,
5558
hidden: false,
5659
btnContextual: 'btn-default',
5760
variation: 'dropdown',

0 commit comments

Comments
 (0)