Skip to content

sweet7788/paging-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

  npm install --save paging-helper

Using

import { PagingHelper } from 'PagingHelper'

const pageCount = 36
const limit = 10

let data = []
let offset = 0
for (let i = 0; i < pageCount; i++) {
  data.push(i)
}

const PagingHelper = new PagingHelper(limit, offset)

let initData = data.slice(offset, offset + limit)
PagingHelper.setData(initData)

PagingHelper.offset         // 0
PagingHelper.accumulator    // [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
PagingHelper.hasMoreData    // true

PagingHelper.loadMore([11, 12, 13, 14, 15, 16, 17, 18, 19. 20])

PagingHelper.offset         // 1
PagingHelper.accumulator    // [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
PagingHelper.hasMoreData    // true

Introduce

In most case, We have lots of variable with paging. 
It is a util for you to manage your paging.
Just for have a clear mind!

Future

PagingHelper is used for mobile.
In the near future, it will support PC

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published