All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.web.lib.js.bee.pagebar.js Maven / Gradle / Ivy

There is a newer version: 6.2.04
Show newest version
var _pg_style=[];_pg_style.push("");document.write(_pg_style.join(""));var dialog=top.dialog?top.dialog.get(window):null;var Pagebar=function(f){var g=this;this.tb=f;this.bar=f._pagebar||f._tfoot.find(".pagebar").eq(0);if(this.bar.length==0){return}if(dialog){var h=$(".ui-dialog-footer",dialog.node);if(h.length>0){var e=$(">.ui-dialog-statusbar",h).show();f._tfoot.hide();e.empty().append(this.bar)}}this.bar.parent().attr("colspan",g.tb.heads.length||1);this.minbar=$(".minpagebar",f._table.parent()).eq(0);this.simple=this.bar.attr("simple")==="true";this.setting=(this.bar.attr("setting")||"").split(",");this.setting.unshift("loading");this.pagesize=parseInt(this.bar.attr("pagesize"))||20;this.number=parseInt(this.bar.attr("number"))||5;if(this.simple){this._initSimple()}else{this._init()}this.ok=true};Pagebar.prototype={ok:false,setting:[],simple:true,bar:null,type:null,pagesize:400,pageno:1,pagenos:1,total:0,setColumn:function(b){this.bar.parent().attr("colspan",b)},setPagesize:function(b){this.pagesize=b;this.total=0},setPageno:function(b){this.pageno=b},first:function(){this.pageno=1;this.go()},next:function(){if(this.pageno>=this.pagenos){return}this.pageno++;this.go()},prev:function(){if(this.pageno<=1){return}this.pageno--;this.go()},last:function(){this.pageno=this.pagenos;this.go()},go:function(){if(this.pageno>this.pagenos||this.pageno<1){this.pageno=1}if(this.$jump){this.$jump.find("input").val(this.pageno>=this.pagenos||this.pageno<1?1:(this.pageno+1))}this.bar.addClass("data-loading");this.tb.go();this._refresh()},loaded:function(){if(this.$loading){this.$loading.hide()}if(this.$total){this.$total.find(".total").text(this.total)}if(this.$pageno){this.$pageno.find(".curpageno").text(this.pageno);this.$pageno.find(".totalpageno").text(this.pagenos)}this.bar.removeClass("data-loading");this._refresh();this.bar.parent().show()},$loading:null,$first:null,$prev:null,$next:null,$last:null,$pageno:null,$pagesize:null,$number:null,$total:null,$jump:null,items:{first:"",prev:"",next:"",last:"",pageno:"1/1",pagesize:"",number:"",total:"总量:0",jump:">>"},_refresh:function(){var h=this;if(this.pageno==1){if(h.$first){h.$first.css("cursor","not-allowed").unbind("click")}if(h.$prev){h.$prev.css("cursor","not-allowed").unbind("click")}}else{if(h.$first){h.$first.css("cursor","pointer").unbind("click").bind("click",function(a){h.first()})}if(h.$prev){h.$prev.css("cursor","pointer").unbind("click").bind("click",function(a){h.prev()})}}if(this.pageno==this.pagenos){if(h.$next){h.$next.css("cursor","not-allowed").unbind("click")}if(h.$last){h.$last.css("cursor","not-allowed").unbind("click")}}else{if(h.$next){h.$next.css("cursor","pointer").unbind("click").bind("click",function(a){h.next()})}if(h.$last){h.$last.css("cursor","pointer").unbind("click").bind("click",function(a){h.last()})}}if(this.$number){h.$number.show();var g=h.pageno-parseInt(h.number/2),i=g+h.number-1;if(g<=0){g=1}i=Math.min(Math.max(g+h.number-1,1+1+h.number),h.pagenos);if(i>=h.pagenos-2){i=h.pagenos}g=Math.min(g,h.pagenos-h.number-1);if(g<=2){g=1}h.$number.html("");if(g<=parseInt(h.number/2)){g=1}else{var f=$("1").appendTo(h.$number);f.click(function(){h.pageno=parseInt($(this).attr("num"));h.go()});$("").click(function(){h.pageno=Math.max(1,h.pageno-h.number);h.go()}).appendTo(h.$number)}for(var j=g;j<=i;j++){var f=$(""+j+"").appendTo(h.$number);if(j==h.pageno){f.addClass("current")}else{f.attr("title","第"+j+"页")}f.click(function(){h.pageno=parseInt($(this).attr("num"));h.go()})}if(i…").click(function(){h.pageno=Math.min(h.pagenos,h.pageno+h.number);h.go()}).appendTo(h.$number);var f=$(""+h.pagenos+"").appendTo(h.$number);f.click(function(){h.pageno=parseInt($(this).attr("num"));h.go()})}}if(h.simple&&this.pageno>=h.pagenos&&h.$more){h.$more.html("数据全部加载完成!").unbind("click").hide()}if(h.minbar&&h.minbar.length>0){h.minbar.empty();h.$first.clone(true).appendTo(h.minbar);h.$prev.clone(true).appendTo(h.minbar);h.$pageno.clone(true).appendTo(h.minbar);h.$next.clone(true).appendTo(h.minbar);h.$last.clone(true).appendTo(h.minbar)}},_initPagesize:function(){var b=this;if(b.$pagesize){b.$pagesize.find("select").change(function(){b.pageno=1;b.setPagesize(this.value);b.go()}).find("option[value="+b.pagesize+"]").attr("selected","selected")}},_initJump:function(){var b=this;b.$jump.find("input").keydown(function(a){if(a.keyCode==13){b.pageno=parseInt(b.$jump.find("input").val())||1;b.go()}}).keypress(function(d){var a=d.keyCode||d.charCode;if(a<48||a>57){d.returnValue=false;d.preventDefault();d.stopPropagation()}});b.$jump.find(".button").unbind("click").bind("click",function(a){b.pageno=parseInt(b.$jump.find("input").val())||1;b.go()})},_initNumber:function(){var b=this},_init:function(){var b=this;$.each(b.setting,function(a,d){b["$"+d]=$(b.items[d]).appendTo(b.bar);switch(d){case"pagesize":b._initPagesize();break;case"pageno":break;case"total":break;case"jump":b._initJump();break;case"number":b._initNumber();break;case"loading":default:}});$(window).keydown(function(a){if(a.target.nodeName.match(/input/ig)){return}var d=document.documentElement.scrollTop||document.body.scrollTop;if(a.ctrlKey==true&&a.keyCode==37){b.first();return}else{if(a.ctrlKey==true&&a.keyCode==39){b.last();return}}switch(a.keyCode){case 37:b.prev();break;case 39:b.next();break;case 38:if(d<=0&&b.pageno>1){b.prev()}break;case 40:let clientHeight=document.documentElement.clientHeight||document.body.clientHeight;let scrollHeight=document.documentElement.scrollHeight||document.body.scrollHeight;if(b.pageno=scrollHeight){b.next()}break}})},_initSimple:function(){var b=this;b.$loading=$(b.items.loading).appendTo(b.bar);b.$more=$("加载更多>>").css("cursor","pointer").click(function(){b.next()});b.bar.append(b.$more);$(window).keydown(function(a){if(a.target.nodeName.match(/input/ig)){return}if(a.keyCode==39){b.next()}})}};




© 2015 - 2024 Weber Informatics LLC | Privacy Policy