Skip to content

Commit 07b3e7a

Browse files
committed
fix #462
1 parent dc67221 commit 07b3e7a

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/BootstrapTable.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ BootstrapTable.propTypes = {
930930
onRowClick: PropTypes.func,
931931
page: PropTypes.number,
932932
pageStartIndex: PropTypes.number,
933-
paginationShowsTotal: PropTypes.bool,
933+
paginationShowsTotal: PropTypes.oneOfType([ PropTypes.bool, PropTypes.func ]),
934934
sizePerPageList: PropTypes.array,
935935
sizePerPage: PropTypes.number,
936936
paginationSize: PropTypes.number,

src/pagination/PaginationList.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,16 @@ class PaginationList extends Component {
7878
});
7979

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

87+
if (typeof paginationShowsTotal === 'function') {
88+
total = paginationShowsTotal(start, to, dataSize);
89+
}
90+
8791
return (
8892
<div className='row' style={ { marginTop: 15 } }>
8993
{

0 commit comments

Comments
 (0)