Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Jan 25, 2016
2 parents dad7c1e + 0825072 commit 8f8ce47
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 40 deletions.
3 changes: 3 additions & 0 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<meta charset="utf-8">
<title>react-bootstrap-table demo</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<script src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>

</head>
<body>
<div id="root"></div>
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
},
"dependencies": {
"classnames": "^2.1.2",
"react-onclickoutside": "^4.5.0",
"react-toastr": "^2.3.1"
},
"peerDependencies": {
Expand Down
37 changes: 6 additions & 31 deletions src/pagination/PaginationList.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,14 @@
import React from 'react';
import PageButton from './PageButton.js';
import Const from '../Const';
import listensToClickOutside from 'react-onclickoutside/decorator';

@listensToClickOutside()
class DropdownMenu extends React.Component {
handleClickOutside() {
this.props.hide();
}

render() {
return (
<ul className="dropdown-menu" role="menu" aria-labelledby="pageDropDown" style={{display: 'block'}}>
{this.props.children}
</ul>
);
}
}

class PaginationList extends React.Component {

constructor(props) {
super(props);
this.state = {
currentPage: this.props.currPage,
sizePerPage: this.props.sizePerPage,
dropdownVisible: false
sizePerPage: this.props.sizePerPage
};
}

Expand Down Expand Up @@ -62,7 +45,6 @@ class PaginationList extends React.Component {

changeSizePerPage(e) {
e.preventDefault();
this.setState({ dropdownVisible: false })

var selectSize = parseInt(e.currentTarget.text);
if (selectSize != this.state.sizePerPage) {
Expand Down Expand Up @@ -103,24 +85,17 @@ class PaginationList extends React.Component {
{
this.props.sizePerPageList.length > 1 ?
<div className="dropdown">
<button
className="btn btn-default dropdown-toggle ignore-react-onclickoutside"
type="button"
id="pageDropDown"
onClick={() => this.setState({ dropdownVisible: !this.state.dropdownVisible })}
aria-expanded="true">
<button className="btn btn-default dropdown-toggle" type="button" id="pageDropDown" data-toggle="dropdown"
aria-expanded="true">
{this.state.sizePerPage}
<span>
{" "}
<span className="caret"/>
</span>
</button>
{ this.state.dropdownVisible ?
<DropdownMenu hide={() => this.setState({ dropdownVisible: false })}>
{sizePerPageList}
</DropdownMenu>
: ""
}
<ul className="dropdown-menu" role="menu" aria-labelledby="pageDropDown">
{sizePerPageList}
</ul>
</div>
: ""
}
Expand Down
8 changes: 0 additions & 8 deletions webpack.production.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ module.exports = {
amd: 'react'
}
},
{
'react-onclickoutside': {
root: 'OnClickOutside',
commonjs2: 'react-onclickoutside',
commonjs: 'react-onclickoutside',
amd: 'react-onclickoutside'
}
},
{
'react-dom': {
root: 'ReactDOM',
Expand Down

0 comments on commit 8f8ce47

Please sign in to comment.