Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const options = {
// withFirstAndLast: false, // Hide the going to First and Last page button
// hideSizePerPage: true, // Hide the sizePerPage dropdown always
// hidePageListOnlyOnePage: true, // Hide the pagination list when only one page
showOnTop: true,
firstPageText: 'First',
prePageText: 'Back',
nextPageText: 'Next',
Expand All @@ -57,6 +58,7 @@ const options = {
// withFirstAndLast: false // Hide the going to First and Last page button
// hideSizePerPage: true, // Hide the sizePerPage dropdown always
// hidePageListOnlyOnePage: true, // Hide the pagination list when only one page
showOnTop: true,
firstPageText: 'First',
prePageText: 'Back',
nextPageText: 'Next',
Expand Down
1 change: 1 addition & 0 deletions packages/react-bootstrap-table2-paginator/src/const.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export default {
STYLE: {},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a little not make sense to define a style object as a constant variable, you can just remove it and defined in the component

PAGINATION_SIZE: 5,
PAGE_START_INDEX: 1,
With_FIRST_AND_LAST: true,
Expand Down
4 changes: 3 additions & 1 deletion packages/react-bootstrap-table2-paginator/src/pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ class Pagination extends pageResolver(Component) {
'col-md-6 col-xs-6 col-sm-6 col-lg-6', {
'react-bootstrap-table-pagination-list-hidden': (hidePageListOnlyOnePage && totalPages === 1)
});
const style = this.props.style ? this.props.style : {};
return (
<div className="row react-bootstrap-table-pagination">
<div style={ style } className="row react-bootstrap-table-pagination">
<div className="col-md-6 col-xs-6 col-sm-6 col-lg-6">
{
sizePerPageList.length > 1 && !hideSizePerPage ?
Expand All @@ -127,6 +128,7 @@ class Pagination extends pageResolver(Component) {
}

Pagination.propTypes = {
style: PropTypes.object,
dataSize: PropTypes.number.isRequired,
sizePerPageList: PropTypes.array.isRequired,
currPage: PropTypes.number.isRequired,
Expand Down
14 changes: 9 additions & 5 deletions packages/react-bootstrap-table2-paginator/src/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ import Const from './const';
import Pagination from './pagination';
import { getByCurrPage } from './page';

export default (Base, {
remoteResolver
}) =>
export default (Base, { remoteResolver }) =>
class PaginationWrapper extends remoteResolver(Component) {
static propTypes = {
store: PropTypes.object.isRequired
}
};

constructor(props) {
super(props);
Expand Down Expand Up @@ -129,9 +127,10 @@ export default (Base, {
this.props.data :
getByCurrPage(store, pageStartIndex);

return [
const renderComponent = [
<Base key="table" { ...this.props } data={ data } />,
<Pagination
style={ options.style || Const.STYLE }
key="pagination"
dataSize={ options.totalSize || store.data.length }
currPage={ currPage }
Expand All @@ -155,5 +154,10 @@ export default (Base, {
lastPageTitle={ options.lastPageTitle || Const.LAST_PAGE_TITLE }
/>
];

if (options.showOnTop) {
return (renderComponent.reverse());
}
return renderComponent;
}
};