Coder Social home page Coder Social logo

angular-paging's Introduction

Angular Paging

npm version bower version Build Status CDN

Demo Available At: http://brantwills.github.io/Angular-Paging/

An Angular directive to aid paging large datasets requiring minimum paging information. This paging directive is unique in that we are only interested in the active page of items rather than holding the entire list of items in memory. This forces any filtering or sorting to be performed outside the directive.


Background

I have often found myself paging across millions of log rows or massive non-normalized lists even after some level of filtering by date range or on some column value. These scenarios have pushed me to develop a reusable paging scheme which just happens to drop nicely into AngularJS.


Installation and Contribution

The core of this project is a simple angular directive which allows you to use the code in many different ways. If you are interested in keeping current with bug fixes and features, we support both bower and npm install commands. If you just want to grab the latest or work with CDN's, head over to the distribution folder for the latest code base. Finally, if you are interested in contributing or see any issues feel free to fork and test away!


Blah Blah Blah.. How to Use!

To include the paging directive in your own project, add the paging.js or paging.min.js file and include the module as a dependency to your angular application. We do support npm and bower if you are familiar with those distribution systems. Please review the src/index.html and src/app.js files for a working version of the directive if you are new to angular modules.

// Add the Angular-Paging module as a dependency to your application module:
var app = angular.module('yourApp', ['bw.paging'])

Code Samples

alt text

<!-- Simple Example -->
<div paging
  page="35" 
  page-size="10" 
  total="1000"
  paging-action="foo('bar', page)">
</div> 

alt text

<!-- Advanced Example -->
<paging
  class="small"
  page="currentPage" 
  page-size="pageSize" 
  total="total"
  pg-href="#GotoPage-{page}"
  adjacent="{{adjacent}}"
  dots="{{dots}}"
  scroll-top="{{scrollTop}}" 
  hide-if-empty="{{hideIfEmpty}}"
  ul-class="{{ulClass}}"
  active-class="{{activeClass}}"
  disabled-class="{{disabledClass}}"
  show-prev-next="{{showPrevNext}}"
  show-first-last="{{showFirstLast}}"
  text-first="&laquo;"
  text-last="&raquo;"
  text-next="&rsaquo;"
  text-prev="&lsaquo;"
  text-title-page="Page {page} hover title text"
  text-title-first="First Page hover title text"
  text-title-last="Last Page hover title text"
  text-title-next="Next Page hover title text"
  text-title-prev="Previous hover Page title text"  
  text-first-class="glyphicon glyphicon-backward"
  text-last-class="glyphicon glyphicon-forward" 
  text-next-class="glyphicon glyphicon-chevron-right"
  text-prev-class="glyphicon glyphicon-chevron-left"
  paging-action="DoCtrlPagingAct('Paging Clicked', page, pageSize, total)">
</paging>   

See src/index.html for complete code samples and documentation


Programmatic Goals

I wanted to create an angular directive I could easily reuse and tie back into a controller. Programmatically I wanted to limit the "paging" information a developer would have to pass into the directive. There are some optional directive attributes for handling CSS classes and hiding previous and next arrows. The following three attributes are required directive inputs:

  1. page What page am I currently viewing
  2. pageSize How many items in the list to display on a page
  3. total What is the total count of items in my list

Visual Goals

I set out to develop a paging display which would allow the user to quickly move to the next or previous page while still allowing them to move to the first or last page instantly. Visually I selected the common pattern 1 2 ... 7 8 9 ... 100 101 where the count inside the dot ellipsis changes as the pages increase or decrease.

See Full Demo for complete samples and documentation

angular-paging's People

Contributors

brantwills avatar optyler avatar overbid avatar void avatar

Watchers

 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.