- Notifications
You must be signed in to change notification settings - Fork650
A jQuery plugin to provide simple yet fully customisable pagination.
License
superRaytin/paginationjs
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A jQuery plugin to provide simple yet fully customisable pagination.
See demos and full documentation at official site:http://pagination.js.org
npm install paginationjs orbower install paginationjs or just downloadpagination.js from the git repo.
<divid="data-container"></div><divid="pagination-container"></div>
$('#pagination-container').pagination({dataSource:[1,2,3,4,5,6,7, ...,195],callback:function(data,pagination){// template method of yourselfvarhtml=template(data);$('#data-container').html(html);}})
Below is a minimal rendering method:
functionsimpleTemplating(data){varhtml='<ul>';$.each(data,function(index,item){html+='<li>'+item+'</li>';});html+='</ul>';returnhtml;}
Call:
$('#pagination-container').pagination({dataSource:[1,2,3,4,5,6,7, ...,195],callback:function(data,pagination){varhtml=simpleTemplating(data);$('#data-container').html(html);}})
To make it easier to maintain, you'd better to use specialized templating engine to do that. Such asHandlebars andUndercore.template.
<scripttype="text/template"id="template-demo"><ul>{{#each data}}<li>{{this}}</li>{{/each}}</ul></script>
$('#pagination-container').pagination({dataSource:[1,2,3,4,5,6,7, ...,195],callback:function(data,pagination){varhtml=Handlebars.compile($('#template-demo').html(),{data:data});$('#data-container').html(html);}})
<scripttype="text/template"id="template-demo"><ul><%for(vari=0,len=data.length;i<len;i++){%><li><%=data[i]%></li><%}%> </ul></script>
$('#pagination-container').pagination({dataSource:[1,2,3,4,5,6,7, ...,195],callback:function(data,pagination){varhtml=_.template($('#template-demo').html(),{data:data});$('#data-container').html(html);}})
Or any other templating engine you prefer.
Released under the MIT license.
MIT:http://rem.mit-license.org, SeeLICENSE
About
A jQuery plugin to provide simple yet fully customisable pagination.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Contributors4
Uh oh!
There was an error while loading.Please reload this page.
