diff --git a/src/BootstrapTable.js b/src/BootstrapTable.js index 3f4578c72..8b69b7b03 100644 --- a/src/BootstrapTable.js +++ b/src/BootstrapTable.js @@ -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, diff --git a/src/pagination/PaginationList.js b/src/pagination/PaginationList.js index 276d41670..43f446076 100644 --- a/src/pagination/PaginationList.js +++ b/src/pagination/PaginationList.js @@ -78,12 +78,16 @@ class PaginationList extends Component { }); const offset = Math.abs(Const.PAGE_START_INDEX - pageStartIndex); - const total = paginationShowsTotal ? - Showing rows { ((currPage - pageStartIndex) * sizePerPage) } to  - { Math.min((sizePerPage * (currPage + offset) - 1), dataSize) } of  - { dataSize } + const start = ((currPage - pageStartIndex) * sizePerPage); + const to = Math.min((sizePerPage * (currPage + offset) - 1), dataSize); + let total = paginationShowsTotal ? + Showing rows { start } to { to } of { dataSize } : null; + if (typeof paginationShowsTotal === 'function') { + total = paginationShowsTotal(start, to, dataSize); + } + return (
{