Giter Club home page Giter Club logo

githubapiuserapp's Introduction

Simple Pagination Plugin in jQuery / Bootstrap 4

A simple, dynamic, Bootstrap based paging system that provides a convenient pagination control for tabular data and/or long lists.

Bootstrap 4 Pagination

Live Demo.

Getting Started

In various front-end application developers intend to paginate tabular data / data list in their own custom way.

  • sometimes, without page refresh for fast user interactivity
  • sometimes, in a regular pagination with page refresh by sending limit/offset query strings
  • sometimes, with searchable form parameters

For such circumstances, my pagination plugin can be used easily. see demo

Prerequisites

Before you begin, you need following things to be loaded beforehand:

  • jQuery 2+ [ tested upto 3.4.1+ ]
  • Bootstrap CSS 3+ [ tested upto 4.3.1+ ]

Usage

Include the (minified) JavaScript Templates script in your HTML markup:

<script src="pagination.min.js"></script>

Then initialize the plugin function with you pagination item as below:

$('[ pagination-menu-holder ]').rpmPagination({ domElement: '[ pagination-item ]' });

Here,

  • [ pagination-menu-holder ] => any suitable html tag [ e.g <ul> ] or id [ e.g #custom_pagination ] or class [ e.g .custom-pagimation ]
  • [ pagination-item ] => Pagination item elements which are to be viewed in pagination

Options

Option parameters are as follows:

domElement

  • Type: string
  • Optional: No, if refresh flag is disabled

Common class element for all tabular data items. The items of the active pagination number will be shown, other class elements will be kept hidden
[see demo](https://projects.sabbirrupom.com/rpm-pagination/test/example-1.html

limit

  • Type: integer
  • Optional: Yes
  • Default: 10

Pagination items limit which are to be displayed in each pagination

currentPage

  • Type: integer
  • Optional: Yes
  • Default: 1

If provided, corresponding pagination menu link will be set to active

total

  • Type: integer
  • Optional: Yes
  • Default: total domElement are counted, if refresh flag is disabled

Total number of page items for pagination

refresh

  • Type: boolean
  • Optional: Yes
  • Default: false

Refresh flag enables page refresh with limit/offset parameters to pass alongside [ GET / POST ]

link

  • Type: string
  • Optional: No, if refresh flag is enabled and search formElement is not set. optional otherwise

Page refresh link where server will fetch data according to limit and offset parameter which is sent as get query string see demo

formElement

  • Type: string
  • Optional: Yes

User can set this parameter with pagination configuration to point out the custom item search filter form (if exists) if configured with valid form identifier element, search form will be submitted to form action url along with limit / offset parameter from pagination menu link. see demo

Sample Template

<div class="page-item">content 1</div>
<div class="page-item">content 2</div>
<div class="page-item">content 3</div>
<div class="page-item">content 4</div>
<div class="page-item">content 5</div>
<div class="page-item">content 6</div>

<ul class="pagination custom-pagination"></ul>

<script>
    $(document).ready(function () {
        $('.custom-pagination').rpmPagination({
            limit: 3,
            total: 6,
            domElement: '.page-item'
        });
    });
</script>

Browser Support

  • Google Chrome
  • Mozilla Firefox
  • Microsoft Edge
  • Safari

Author

โฌ† back to top

githubapiuserapp's People

Contributors

sohambhat avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.