@locustjs/pagination

2.0.1 • Public • Published

@locustjs/pagination

This library provides utilities regarding paging and pagination for data grids.

Install

npm i @locustjs/pagination

The library contains a pagingCalc function that helps calculating paging based on a given recordcount, pagesize and current page.

Example:

import { pagingCalc } from 'locustjs-pagination';

const pageSize = 8;
const recordCount = 456;
const currentPage = 20;
const visiblePages = 6;

const paging = pagingCalc(currentPage, recordCount, pageSize, visiblePages);

console.log(paging);
/*
  result:
  {
    fromPage: 19
    fromRow: 153
    page: 20
    pageCount: 57
    pageSize: 8
    recordCount: 456
    toPage: 24
    toRow: 160
    visiblePages: 6
  }
*/

Dependencies (1)

Dev Dependencies (3)

Package Sidebar

Install

npm i @locustjs/pagination

Weekly Downloads

0

Version

2.0.1

License

MIT

Unpacked Size

8.4 kB

Total Files

5

Last publish

Collaborators

  • mansoor-omrani