|
1 | 1 | import React from 'react';
|
2 | 2 | import PageButton from './PageButton.js';
|
3 | 3 | import Const from '../Const';
|
4 |
| -import listensToClickOutside from 'react-onclickoutside/decorator'; |
5 |
| - |
6 |
| -@listensToClickOutside() |
7 |
| -class DropdownMenu extends React.Component { |
8 |
| - handleClickOutside() { |
9 |
| - this.props.hide(); |
10 |
| - } |
11 |
| - |
12 |
| - render() { |
13 |
| - return ( |
14 |
| - <ul className="dropdown-menu" role="menu" aria-labelledby="pageDropDown" style={{display: 'block'}}> |
15 |
| - {this.props.children} |
16 |
| - </ul> |
17 |
| - ); |
18 |
| - } |
19 |
| -} |
20 | 4 |
|
21 | 5 | class PaginationList extends React.Component {
|
22 | 6 |
|
23 | 7 | constructor(props) {
|
24 | 8 | super(props);
|
25 | 9 | this.state = {
|
26 | 10 | currentPage: this.props.currPage,
|
27 |
| - sizePerPage: this.props.sizePerPage, |
28 |
| - dropdownVisible: false |
| 11 | + sizePerPage: this.props.sizePerPage |
29 | 12 | };
|
30 | 13 | }
|
31 | 14 |
|
@@ -62,7 +45,6 @@ class PaginationList extends React.Component {
|
62 | 45 |
|
63 | 46 | changeSizePerPage(e) {
|
64 | 47 | e.preventDefault();
|
65 |
| - this.setState({ dropdownVisible: false }) |
66 | 48 |
|
67 | 49 | var selectSize = parseInt(e.currentTarget.text);
|
68 | 50 | if (selectSize != this.state.sizePerPage) {
|
@@ -103,24 +85,17 @@ class PaginationList extends React.Component {
|
103 | 85 | {
|
104 | 86 | this.props.sizePerPageList.length > 1 ?
|
105 | 87 | <div className="dropdown">
|
106 |
| - <button |
107 |
| - className="btn btn-default dropdown-toggle ignore-react-onclickoutside" |
108 |
| - type="button" |
109 |
| - id="pageDropDown" |
110 |
| - onClick={() => this.setState({ dropdownVisible: !this.state.dropdownVisible })} |
111 |
| - aria-expanded="true"> |
| 88 | + <button className="btn btn-default dropdown-toggle" type="button" id="pageDropDown" data-toggle="dropdown" |
| 89 | + aria-expanded="true"> |
112 | 90 | {this.state.sizePerPage}
|
113 | 91 | <span>
|
114 | 92 | {" "}
|
115 | 93 | <span className="caret"/>
|
116 | 94 | </span>
|
117 | 95 | </button>
|
118 |
| - { this.state.dropdownVisible ? |
119 |
| - <DropdownMenu hide={() => this.setState({ dropdownVisible: false })}> |
120 |
| - {sizePerPageList} |
121 |
| - </DropdownMenu> |
122 |
| - : "" |
123 |
| - } |
| 96 | + <ul className="dropdown-menu" role="menu" aria-labelledby="pageDropDown"> |
| 97 | + {sizePerPageList} |
| 98 | + </ul> |
124 | 99 | </div>
|
125 | 100 | : ""
|
126 | 101 | }
|
|
0 commit comments