Coder Social home page Coder Social logo

jpagerajax's Introduction

jPagerAjax

create page from ajax data

jPagerAjax效果图

jPagerAjax效果图

参数

  • @config {string} position 分页显示的位置; after: 在内容的后面,before: 在内容的前面

  • @config {Boolean} showLength 首否显示总共多少条;true: 显示共多少条信息, false: 不显示

  • @config {Boolean} showSelect 是否显示选择下拉框;true: 显示下拉框选择条数, false: 不显示

  • @config {Boolean} showAction 是否显示首页,末页,上一页,下一页;true: 显示, false: 不显示

  • @config {int} perPage 每页显示多少条信息

  • @config {int} totalCount 总共多少条信息

  • @config {array} select 下拉框的信息,这个是showSelect为true时设置才有效 [10, 20, 50, 100]

  • @config {int} curPage 默认显示哪一页

  • @config {int} pageCount 总共多少页

  • @config {object} textmap: { first: "首页", last: "末页", prev: "上一页", next: "下一页" }

  • @config {function} onPageClick 页码点击事件

  • @config {function} onSelect 下拉框点击事件

  • @config {string} children 孩子元素

使用方法

引用css, js

<link rel="stylesheet" type="text/css" href="jPagerAjax/jPagerAjax.css">

<script type="text/javascript" src="jPagerAjax/jquery-1.8.0.js"></script>

<script type="text/javascript" src="jPagerAjax/jquery.jPagerAjax.js"></script>

$("#table").jPagerAjax({
position: "after",  

showLength: true,  

showSelect: true, 

showAction: true,  

perPage: data.per_page,  

totalCount: data.total,  

select: [10, 20, 50, 100],

curPage: data.cur_page,  

pageCount: Math.ceil(data.total/data.per_page), 

textmap: {
	first: "首页",
	last: "末页",
	prev: "上一页",
	next: "下一页"
}, 

onPageClick:  function(curPage){  
	if(curPage!=""){
		renderTable(curPage, per_page);							
	}
},

onSelect: function(perPage){
	renderTable(1, perPage);
},  

children: "tr"                

});

jpagerajax's People

Contributors

joannamo avatar

Watchers

James Cloos 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.