function fnchangename(value,jsarray){ var result=""; for(var i=0;i数据正在加载中"); $.post(url,params,function(responsetext){ var json=eval("("+responsetext+")"); var total=json.totalproperty; //总记录数 $("#"+list_div).empty().append(grid.store(json)); // if(grid.afterload!=null)grid.afterload(); //gridload({id:list_div,single:single}); if(total==0){ $("#"+nav_div).empty(); }else{ $("#"+nav_div).mypagination(total,{perpage:length,showtype:showtype,currentpage:currentpage,callback:function(pospage){ $("#"+list_div).empty().append("
数据正在加载中
"); params.start=(pospage-1)*length; $.post(url,params,function(responsetext){ var json=eval("("+responsetext+")"); $("#"+list_div).empty().append(grid.store(json)); gridload({id:list_div,single:single}); }); } }); } }); } //分页 function gridpage(grid){ var url=grid.url;//请求url var single=grid.signle;//是否单选 if(single==null)single=false; var param=grid.param;//传递参数 var list_div=grid.bodyid;//数据id var nav_div=grid.pagenavid;//分页导航id var showtype=grid.showtype;//分页类型 if(showtype==null)showtype=3; var length=grid.length;//每页记录数 if(length==null)length=10; var currentpage=1; var params = {}; if(param==null ||param==undefined){ param = {}; }else{ if(param!=""){ var str = param.split("&"); for(var i=0;i数据正在加载中"); $.post(url,params,function(responsetext){ var json=eval("("+responsetext+")"); var total=json.totalproperty; //总记录数 $("#"+list_div).empty().append(grid.store(json)); // if(grid.afterload!=null)grid.afterload(); //gridload({id:list_div,single:single}); if(total==0){ $("#"+nav_div).empty(); }else{ $("#"+nav_div).mypagination(total,{perpage:length,showtype:showtype,currentpage:currentpage,callback:function(pospage){ $("#"+list_div).empty().append("
数据正在加载中
"); params.start=(pospage-1)*length; $.post(url,params,function(responsetext){ var json=eval("("+responsetext+")"); $("#"+list_div).empty().append(grid.store(json)); gridload({id:list_div,single:single}); }); } }); } }); } $.fn.mypagination = function(totalproperty,opts){ opts = $.extend({ perpage:0, callback:function(){ } },opts||{}); return this.each(function(){ function numpages(){ return math.ceil(totalproperty/opts.perpage); } function selectpage(page,rendflag){ return function(){ currpage = page; if (page<0) currpage = 0; if (page>=numpages()) currpage = numpages()-1; eval("render"+opts.showtype+"();"); opts.callback(currpage+1); document.documentelement.scrolltop = document.body.scrolltop =0; if(rendflag==4){ window.timer1=settimeout(function(){ },1000); } } } function render1_bak(){ var html= '' ; html+=''; if(currpage > 0){ html+='[首页]'; html+='[上页]'; }else{ html+='[首页]'; html+='[上页]'; } if (currpage < numpages()-1){ html+='[下页]'; html+='[尾页]'; }else{ html+='[下页]'; html+='[尾页]'; } html+='第页/共'+numpages()+'页'; html+='共'+totalproperty+'条记录'; html+=''; panel.empty(); panel.append(html); $(".page-first",panel).bind('click',selectpage(0)); $(".page-prev",panel).bind('click',selectpage(currpage-1)); $(".page-next",panel).bind('click',selectpage(currpage+1)); $(".page-last",panel).bind('click',selectpage(numpages()-1)); $('input.page-num',panel).val(currpage+1).keydown(function(event){ if(event.keycode==13){ selectpage($(this).val()-1)(); } }); } function render1(){ var html= '' ; html+=''; panel.empty(); panel.append(html); $(".page-first",panel).bind('click',selectpage(0)); $(".page-prev",panel).bind('click',selectpage(currpage-1)); $(".page-next",panel).bind('click',selectpage(currpage+1)); $(".page-last",panel).bind('click',selectpage(numpages()-1)); $('input.page-num',panel).val(currpage+1).keydown(function(event){ if(event.keycode==13){ selectpage($(this).val()-1)(); } }); } function render6(){ var html= '' ; if(currpage > 0){ html+='第一页    '; html+='上一页    '; }else{ html+='第一页    '; html+='上一页    '; } if (currpage < numpages()-1){ html+='下一页    '; html+='最后页    '; }else{ html+='下一页    '; html+='最后页    '; } html+=' 第'+(currpage+1)+'页/共'+numpages()+'页'; html+=' 共'+totalproperty+'条记录'; panel.empty(); panel.append(html); $("#page-first",panel).bind('click',selectpage(0)); $("#page-prev",panel).bind('click',selectpage(currpage-1)); $("#page-next",panel).bind('click',selectpage(currpage+1)); $("#page-last",panel).bind('click',selectpage(numpages()-1)); $('input.page-num',panel).val(currpage+1).keydown(function(event){ if(event.keycode==13){ selectpage($(this).val()-1)(); } }); } function render4(){ var totalpage=numpages(); var startpoint = 1; var endpoint = 9; if (currpage > 4) { startpoint = currpage - 4; endpoint = currpage + 4; } if (endpoint > totalpage) { startpoint = totalpage - 8; endpoint = totalpage; } if (startpoint < 1) { startpoint = 1; } var html= '' ; //html+='