Skip to main content

Usage

tip

Install the paginatorjs-table plugin if you haven't already. Follow the installation manual.

Example

In order to install the Table plugin, set pluginContainer and instantiate the plugin:

Live Editor
const paginator = new Paginator({
    columns: [
        { 
            name: 'Name',
            formatter: (cell) => `Name: ${cell}`
        },
        'Email',
    ],
    data: Array(50).fill().map(x => [
        faker.person.fullName(),
        faker.internet.email(),
    ]),
    pageSize: 5,
    pluginContainer: document.getElementById('plugin-container'),
    plugins: [
        {
            id: 'myList',
            position: PluginPosition.Body,
            component: Table
        }
    ]
});
Result
Loading...

tablePlugin

The tablePlugin is a plugin object, instead of a FunctionComponent. It can let you add Table plugin directly to the Paginator instance.

Live Editor
const paginator = new Paginator({
    columns: [
        { 
            name: 'Name',
            formatter: (cell) => `Name: ${cell}`
        },
        'Email',
    ],
    data: Array(50).fill().map(x => [
        faker.person.fullName(),
        faker.internet.email(),
    ]),
    pageSize: 5,
    pluginContainer: document.getElementById('plugin-container-tmp'),
    plugins: [tablePlugin]
});
Result
Loading...

tablePlugin has the following properties:

{
id: 'tablePlugin',
position: PluginPosition.Body,
component: Table,
order: 1
}
tip

Follow the Advanced Plugin article to learn more about writing Paginator.js plugins!