Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-bootstrap-table-nextgen-paginator
Advanced tools
It's the pagination addon for react-bootstrap-table-nextgen
react-bootstrap-table-nextgen
separate the pagination code base to react-bootstrap-table-nextgen-paginator
, so there's a little bit different when you use pagination. In the following, we are going to show you how to enable and configure the a pagination table
$ npm install react-bootstrap-table-nextgen-paginator --save
// es5
require('react-bootstrap-table-nextgen-paginator/dist/react-bootstrap-table-nextgen-paginator.min.css');
// es6
import 'react-bootstrap-table-nextgen-paginator/dist/react-bootstrap-table-nextgen-paginator.min.css';
Let's enable a pagination on your table:
import paginationFactory from 'react-bootstrap-table-nextgen-paginator';
// omit...
<BootstrapTable keyField='id' data={ products } columns={ columns } pagination={ paginationFactory() } />
react-bootstrap-table-nextgen
give some simple ways to customize something like text, styling etc, following is all the props we support for basic customization:
You can check this online demo for above props usage.
Sometime, you may feel above props is not satisfied with your requirement, don't worry, we provide following renderer for each part of pagination:
If you want to customize the pagination component completely, you may get interesting on following solutions:
react-bootstrap-table2-paginator
have a PaginationProvider
which is a react context and that will be easier to customize the pagination components under the scope of PaginationProvider
. Let's introduce it step by step:
import paginationFactory, { PaginationProvider } from 'react-bootstrap-table-nextgen-paginator';
const paginationOption = {
custom: true,
totalSize: products.length
};
<PaginationProvider
pagination={ paginationFactory(options) }
>
{
({
paginationProps,
paginationTableProps
}) => (
.....
)
}
</PaginationProvider>
PaginationProvider
actually is a wrapper for the concumser of react context, so that now you have to get the props from context provide then render to your compoennt and BootstrapTable
:
paginationProps
: this include everything about pagination, you will use it when you render standalone component or your custom component.paginationTableProps
: you don't need to know about this, but you have to render this as props to BootstrapTable
.So far, your customization pagination is supposed to look like it:
<PaginationProvider
pagination={ paginationFactory(options) }
>
{
({
paginationProps,
paginationTableProps
}) => (
<div>
<BootstrapTable
keyField="id"
data={ products }
columns={ columns }
{ ...paginationTableProps }
/>
</div>
)
}
</PaginationProvider>
Now, you have to choose which solution you like: standalone or non-standalone ?
react-bootstrap-table-nextgen-paginator
provider three standalone components:
When render each standalone, you just need to pass the paginationProps
props to standalone component:
import paginationFactory, {
PaginationProvider,
PaginationListStandalone,
SizePerPageDropdownStandalone,
PaginationTotalStandalone
} from 'react-bootstrap-table2-paginator';
<PaginationProvider
pagination={ paginationFactory(options) }
>
{
({
paginationProps,
paginationTableProps
}) => (
<div>
<SizePerPageDropdownStandalone
{ ...paginationProps }
/>
<PaginationTotalStandalone
{ ...paginationProps }
/>
<BootstrapTable
keyField="id"
data={ products }
columns={ columns }
{ ...paginationTableProps }
/>
<PaginationListStandalone
{ ...paginationProps }
/>
</div>
)
}
</PaginationProvider>
That's it!! The benifit for using standalone is you can much easier to render the standalone component in any posistion. In the future, we will implement more featue like applying style
, className
etc on standalone components.
PaginationListStandalone
SizePerPageDropdownStandalone
open
: true
to make dropdown show.hidden
: true
to hide the size per page dropdown.btnContextual
: Set the button contextualvariation
: Variation for dropdown, available value is dropdown
and dropup
.className
: Custom the class on size per page dropdownSizePerPageDropdownStandalone
If you choose to custom the pagination component by yourself, the paginationProps
will be important for you. Becasue you have to know for example how to change page or what's the current page etc. Hence, following is all the props in paginationProps
object:
page,
sizePerPage,
pageStartIndex,
hidePageListOnlyOnePage,
hideSizePerPage,
alwaysShowAllBtns,
withFirstAndLast,
dataSize,
sizePerPageList,
paginationSize,
showTotal,
pageListRenderer,
pageButtonRenderer,
sizePerPageRenderer,
paginationTotalRenderer,
sizePerPageOptionRenderer,
firstPageText,
prePageText,
nextPageText,
lastPageText,
prePageTitle,
nextPageTitle,
firstPageTitle,
lastPageTitle,
onPageChange,
onSizePerPageChange,
disablePageTitle
In most of case, page
, sizePerPage
, onPageChange
and onSizePerPageChange
are most important things for developer.
page
: Current page.sizePerPage
: Current size per page.onPageChange
: Call it when you nede to change page. This function accept one number argument which indicate the new pageonSizePerPageChange
: Call it when you nede to change size per page. This function accept two number argument which indicate the new sizePerPage and new pageHere is a online example.
FAQs
It's the pagination addon for react-bootstrap-table-nextgen
The npm package react-bootstrap-table-nextgen-paginator receives a total of 19 weekly downloads. As such, react-bootstrap-table-nextgen-paginator popularity was classified as not popular.
We found that react-bootstrap-table-nextgen-paginator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.