mirror of
https://github.com/gosticks/react-table.git
synced 2025-10-16 11:55:36 +00:00
adding position prop into pagination component (#1205)
- adding isTop prop into pagination component, which allows differentiate if pagination is on top or bottom of the table
This commit is contained in:
parent
26961d0994
commit
c7d2c36454
@ -796,7 +796,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
||||
)
|
||||
}
|
||||
|
||||
const makePagination = () => {
|
||||
const makePagination = (isTop) => {
|
||||
const paginationProps = _.splitProps(
|
||||
getPaginationProps(finalState, undefined, undefined, this)
|
||||
)
|
||||
@ -810,13 +810,13 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
||||
onPageSizeChange={this.onPageSizeChange}
|
||||
className={paginationProps.className}
|
||||
style={paginationProps.style}
|
||||
isTop={isTop}
|
||||
{...paginationProps.rest}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
const makeTable = () => {
|
||||
const pagination = makePagination()
|
||||
return (
|
||||
<div
|
||||
className={classnames('ReactTable', className, rootProps.className)}
|
||||
@ -827,7 +827,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
||||
{...rootProps.rest}
|
||||
>
|
||||
{showPagination && showPaginationTop ? (
|
||||
<div className="pagination-top">{pagination}</div>
|
||||
<div className="pagination-top">{makePagination(true)}</div>
|
||||
) : null}
|
||||
<TableComponent
|
||||
className={classnames(tableProps.className, currentlyResizing ? 'rt-resizing' : '')}
|
||||
@ -851,7 +851,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) {
|
||||
{hasColumnFooter ? makeColumnFooters() : null}
|
||||
</TableComponent>
|
||||
{showPagination && showPaginationBottom ? (
|
||||
<div className="pagination-bottom">{pagination}</div>
|
||||
<div className="pagination-bottom">{makePagination(false)}</div>
|
||||
) : null}
|
||||
{!pageRows.length && (
|
||||
<NoDataComponent {...noDataProps}>{_.normalizeComponent(noDataText)}</NoDataComponent>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user