Coder Social home page Coder Social logo

one-simple-table-paging's Introduction

one-simple-table-paging

A small piece of JS code which does simple table pagination.

OneSimpleTablePaging

Project Description

Unlike most of the other solutions which require a lot of CSS files and images, this project aims to provide an alternative by just doing all the table pagination in one JS file without using any image. Users just need to put in one JS file in their project to have a simple table pagination setup for them.

How to Use

In this section, we will show how OneSimpleTablePaging is applied to an existing HTML table which has id "main-table".

To keep it simple, OneSimpleTablePaging only has two things for the users to configure.

  • Simplest case:
    • $('#main-table').oneSimpleTablePagination({});
  • Set the number of rows per page, for example 20 rows per page:
    • $('#main-table').oneSimpleTablePagination({rowsPerPage: 20});
  • Set the position of the pagination bar (can be either on top or bottom of the table):
    • $('#main-table').oneSimpleTablePagination({topNav: true});
    • The code above will have the pagination bar positioned on top of the table.
  • Make the header of the table floating (aka sticky thead):
    • $('#main-table').oneSimpleTablePagination({floatingHeader: true});
    • The code above will have the header of table floating when scrolling page up and down.

By default, rowsPerPage is 10 and topNav is false.

Requirement

  • jQuery Version 1.7.1 or above

Demo

Other Information

The code in this project is based on Ryan Zielke's tablePagination (http://neoalchemy.org/tablePagination.html) which is licensed under the MIT licenses: http://www.opensource.org/licenses/mit-license.php. Button designs are based on Google+ Buttons in CSS design from Pixify (http://pixify.com/blog/use-google-plus-to-improve-your-ui/).

The floating concept is copied from http://stackoverflow.com/a/4709775/1177328 and http://codepen.io/jgx/pen/wiIGc.

You can read more about this project at my blog: http://cuteprogramming.wordpress.com/2012/04/07/259/

one-simple-table-paging's People

Contributors

goh-chunlin avatar jayaramki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  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.