A simple javascript library for pagination, compatible with Bootstrap.

Overview

Easy Pagination JS

A simple library for pagination, compatible with Bootstrap.

Check my website here.

Demo

Check this Demo here. Demo

Example

Import the file

<script src="./easyPagination.js"></script>

Add a div for the items, and one for the pagination buttons.

<div id="list"></div>
<div id="pagination"></div>

Create some example items.

const items = [
  "item 1",
  "item 2",
  "item 3",
  "item 4",
  "item 5",
  "item 6",
  "item 7",
  "item 8",
  "item 9",
  "item 10",
];

Create the pagination object

const paginationOptions = {
  items,
  rows: 5,
  buttonsWrapper: "#pagination",
  handlePaginatedItems: (items) => {
    const list = document.getElementById("list");
    list.innerHTML = "";
    items.forEach((item) => {
      list.innerHTML += `<div>${item}</div>`;
    });
  },
};

Call easyPagination and execute paginate()

easyPagination(paginationOptions).paginate();

Or you can create a pagination object to call different methods.

const pagination = easyPagination(paginationOptions);
pagination.paginate();
pagination.changeRows(50);

Note: you can import Bootstrap CDN for pagination buttons to look nice.

Methods

Syntax Parameters Description Example
paginate() page (default: 1), loadButtons (default: true) Paginates the items and creates the buttons (by default). pagination.paginate()
changeRows() newRows (default: 10) Updates the rows per page, also updates the buttons. pagination.changeRows(25)
changeItems() newItems Updates the items, also updates the buttons. pagination.changeItems(items)
next() Fires next > button behavior. pagination.next()
prev() Fires the < prev button behavior. pagination.prev()

Available Options

Syntax Description Default Value
items Items to paginate. (Array)
rows Rows per page. 10
buttonsWrapper CSS Selector where the buttons where be injected.
handlePaginatedItems Function that receives the paginated items as parameter, if this is null paginate() will return the items.
buttonsContainerClass CSS Class for the buttons container. "pagination"
buttonClass CSS Class for each button. "page-link"
nextClass CSS Class for the "Next" button. "page-link"
prevClass CSS Class for the "Prev" button. "page-link"
nextText Text for the "Next" button. "next >"
prevText Text for the "Prev" button. "< prev"
activeClass CSS Class for the current pagination button. "active"
You might also like...

A handler to create embedded pages with buttons for pagination.

➝ Whats that • A handler to create embedded pages with buttons for pagination. ➝ Requirements • ["Handler"] pages.js • [Example command] embed.js ➝ Us

Oct 30, 2022

URL Shortener API in NodeJS supporting pagination, sort params and lot more

URL Shortener API in NodeJS supporting pagination, sort params and lot more

node-url-shortener Built with ❤️ in NodeJS A simple URL Shortner REST API that uses shortid npm package to generate short endpoints for your long URL.

Sep 22, 2022

Bootstrap Colorpicker is a modular color picker plugin for Bootstrap.

Bootstrap Colorpicker Bootstrap Colorpicker is a modular color picker plugin for Bootstrap 4. THIS PROJECT IS NOT MAINTAINED ANYMORE. After almost 10

Dec 22, 2022

A lightweight, fully-featured, modular, typescript-compatible javascript library for Paymongo.

A lightweight, fully-featured, modular, typescript-compatible javascript library for Paymongo.

paymongo.js A lightweight, fully-featured, modular, typescript-compatible javascript library for PayMongo. Installation npm install paymongo.js # or y

Nov 23, 2022

Zepto.js is a minimalist JavaScript library for modern browsers, with a jQuery-compatible API

Zepto.js – a minimalist JavaScript library Zepto is a minimalist JavaScript library for modern browsers with a largely jQuery-compatible API. If you u

Dec 31, 2022

Simple modern JavaScript ES6 library that fetches JSON data into an HTML table which displays nicely within a Bootstrap 4 Card.

Simple modern JavaScript ES6 library that fetches JSON data into an HTML table which displays nicely within a Bootstrap 4 Card. Uses simplenotsimpler/modern-table library.

Feb 17, 2022

A small and simple stress testing tool for Ethereum-compatible blockchain networks

A small and simple stress testing tool for Ethereum-compatible blockchain networks

Overview pandoras-box is a small transaction stress testing tool, part of any Ethereum client developer's toolkit. It is made for Ethereum-compatible

Aug 30, 2022

A Multichain crypto wallet library that supports Ethereum, Solana and other EVM compatible blockchains.

Multichain Crypto Wallet A Multichain crypto wallet library that supports Ethereum, Solana and other EVM compatible blockchains. Installation npm inst

Jan 2, 2023

Browser library compatible with Node.js request package

Browser Request: The easiest HTTP library you'll ever see Browser Request is a port of Mikeal Rogers's ubiquitous and excellent [request][req] package

Nov 11, 2022
Owner
Wilfredo Paiz
Software Consultant
Wilfredo Paiz
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
A simple Form Validation Utility for Bootstrap 3, Bootstrap 4, and Bootstrap 5 for Humans.

bootstrap-validate A simple Form Validation Utility for Bootstrap 3, Bootstrap 4, and Bootstrap 5 for Humans. ?? Support us with Developer Merchandise

null 138 Jan 2, 2023
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Extends Bootstrap Tooltips and Popovers by adding custom classes. Available for Bootstrap 3 and Bootstrap 4.

Bootstrap Tooltip Custom Class Extends Bootstrap Tooltips and Popovers by adding custom classes. Available for Bootstrap 3 and Bootstrap 4. Define you

Andrei Victor Bulearca 14 Feb 10, 2022
Simple and easy-to-use pagination library for Mongoose (Node.js)

node-paginator Simple and easy-to-use pagination library for Mongoose (Node.js) ?? Why node-paginator? Every web developer should work on pagination a

CareerDay 2 Sep 21, 2022
Build forms from JSON Schema. Easily template-able. Compatible with Bootstrap 3 out of the box.

JSON Form The JSON Form library is a JavaScript client-side library that takes a structured data model defined using JSON Schema as input and returns

null 2.6k Dec 28, 2022
🧬 A type builder for pagination with prisma and type-graphql.

?? Prisma TypeGraphql Pagination Prisma TypeGraphql Pagination builds prisma pagination types for type-graphql. import { ... } from 'type-graphql'

Arthur Fiorette 2 Apr 21, 2022
Holy Qur'an Telegram Bot with pagination and audio, in Indonesian language.

quran-telegram-bot Contributions are Welcome! Demo @fio_quran_bot Run Tested on Node.js v14.x.x with NPM v6.x.x, Windows 10 and Ubuntu 18.04.6 LTS. Cr

Rioze 5 Oct 21, 2022
A jQuery plugin for making html tables searchable and sortable with pagination

jQuery.fancyTable A jQuery plugin for making html tables searchable and sortable with pagination. Live demo See a live demo on CodePen Installation Us

null 45 Dec 19, 2022