var Pager = require( 'react-pager' );
dist/pager.min.js is prebuilded for using in global <script>
tag.
(It's used in JSFiddle demo).
var Pager = require( 'react-pager' );
var PagerDemo = React.createClass({
getInitialState: function () {
return {
total: 11,
current: 7,
visiblePages: 3
};
},
handlePageChanged: function ( newPage ) {
this.setState({ current : newPage });
},
render: function() {
return (<Pager total={this.state.total}
current={this.state.current}
{/* Optional */}
titles={{
first: 'First',
prev: '\u00AB',
prevSet: '...',
nextSet: '...',
next: '\u00BB',
last: 'Last'
}}
visiblePages={this.state.visiblePages}
onPageChanged={this.handlePageChanged}/>);
}
});
React.render(<PagerDemo />, document.body);
First | Prev | ... | 6 | 7 | 8 | 9 | ... | Next | Last
* Bootstrap 3.0 is required by default, but you can replace it with your own css.
gulp demo -p 8003
or
./node_modules/.bin/gulp demo -p 8003
npm test
- Updated to React 0.13.
- Updated local demo.
- Added
titles
property. See demo. - Improved building script.
- Fixed
<li class="undefined" ..
in "more" and "less" buttons. - Added a few unit-tests.