Skip to content

Commit

Permalink
fix #462
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed May 28, 2016
1 parent dc67221 commit 07b3e7a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/BootstrapTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ BootstrapTable.propTypes = {
onRowClick: PropTypes.func,
page: PropTypes.number,
pageStartIndex: PropTypes.number,
paginationShowsTotal: PropTypes.bool,
paginationShowsTotal: PropTypes.oneOfType([ PropTypes.bool, PropTypes.func ]),
sizePerPageList: PropTypes.array,
sizePerPage: PropTypes.number,
paginationSize: PropTypes.number,
Expand Down
12 changes: 8 additions & 4 deletions src/pagination/PaginationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,16 @@ class PaginationList extends Component {
});

const offset = Math.abs(Const.PAGE_START_INDEX - pageStartIndex);
const total = paginationShowsTotal ? <span>
Showing rows { ((currPage - pageStartIndex) * sizePerPage) } to&nbsp;
{ Math.min((sizePerPage * (currPage + offset) - 1), dataSize) } of&nbsp;
{ dataSize }
const start = ((currPage - pageStartIndex) * sizePerPage);
const to = Math.min((sizePerPage * (currPage + offset) - 1), dataSize);
let total = paginationShowsTotal ? <span>
Showing rows { start } to&nbsp;{ to } of&nbsp;{ dataSize }
</span> : null;

if (typeof paginationShowsTotal === 'function') {
total = paginationShowsTotal(start, to, dataSize);
}

return (
<div className='row' style={ { marginTop: 15 } }>
{
Expand Down

0 comments on commit 07b3e7a

Please sign in to comment.