日期:2014-05-16 浏览次数:20417 次
/**
*
* @param {} recordCount 总的记录数
* @param {} pageSize 每页的记录数
* @param {} divId 容纳分页元素的id
* @param {} funPageSearch 回调的查询方法
* currentPage 当前页,默认为1
* @author:yxd
* @email:yxd_yxd2008@163.com
*/
function Pager(recordCount,pageSize,divId,funPageSearch,currentPage){
this.recordCount=recordCount;
this.pageSize=pageSize;
this.pageContainer=$("#"+divId);
this.funPageSearch=funPageSearch;
this.currentPage=currentPage || 1;
this.totalPage=this.calculateTotalPage(recordCount);
this.htmlRecordCount=null;
this.htmlTotalPage=null;
this.htmlInputPage=null;
this.htmlFirstPage=null;
this.htmlPrvPage=null;
this.htmlNextPage=null;
this.htmlLastPage=null;
this.htmlDiv=null;
this.draw();
}
Pager.prototype={
draw:function(){
var oo=this;
var str='共<span>'+this.recordCount+'</span>行 '+
'每页'+this.pageSize+'行 '+
'共<span>'+this.totalPage+'</span>页 '+
'<div style="display:none;">转到第<input value="'+this.currentPage+'" style="width:28px" maxlength="'+this.maxLength()+'">页 '+
'<span>首页</span> '+
'<span>上页</span> '+
'<span>下页</span> '+
'<span>尾页</span></div> ';
this.pageContainer.append(str);
this.htmlRecordCount=$("span:eq(0)",this.pageContainer);