当前位置:编程学习 > JS >>

js分页

function showSimplePageData(n){
          $("#易做图ShowComp").hideLoading();
         $("#易做图ShowComp table").html("");
        $('<tr class="tableTitle"><td>投诉日期</td><td>投诉类型</td><td>投诉个数</td></tr>').appendTo("#易做图ShowComp table");
        $("#detailState").hide();
        $("#易做图State").show();
        //alert(易做图ComplaintRecordList.易做图CurrData[0].complaintDate)
        for(var i=0,j=易做图ComplaintRecordList.易做图CurrData.length;i<j;i++){ //consultationList.currData.length
            var data=易做图ComplaintRecordList.易做图CurrData[i],elem;
            elem=$('<tr><td> '+(data.complaintDate==""?" ":data.complaintDate)+'</td><td>'+complaintsType[data.complaintsType]+'</td><td>'+(data.count==""?" ":data.count)+'</td></td></tr>').appendTo("#易做图ShowComp table");
        }
/*        for(var i=consultationList.currData.length;i<7;i++){
            $('<dt></dt>').appendTo("#first_view dl");
            $('<tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td class="tdend"> </td></tr>').appendTo("#second_view table");
        }*/
         showSimplePages(n);
    }
/**
 * 显示投诉记录
 */
    function showSimplePages(curr){
         var showPages=5;
        var totalNum=易做图ComplaintRecordList.易做图TotalNum;
        var totalPages=易做图ComplaintRecordList.易做图TotalPages;
        var currData=易做图ComplaintRecordList.易做图CurrData;
        var currPage=易做图ComplaintRecordList.易做图CurrPage;
        //var type=consultationList.type;
        var beginPage=1,endPage=1;
        var quotient=Math.floor((curr-1)/showPages);
        beginPage=showPages*quotient+1;
        endPage=(beginPage+4)>totalPages?totalPages:(beginPage+4);
        if(beginPage>showPages && endPage-beginPage<showPages-1){ //保证如果总页数大于showPages 则次显示的页数为showPages
             beginPage=endPage-showPages+1;
        }
        if(totalPages<1){
            beginPage=1,endPage=1,totalPages=1;
        }
        var html='<span class="number w400">';
         html+=curr==1?'<a title="第一页">‹‹</a>':'<a class="valid" title="第一页" href="javascript:goToSimplePage(1);">‹‹</a>';
        html+=curr==1?'<a title="上一页">‹</a>':'<a class="valid" title="上一页"  href="javascript:goToSimplePage(\'prev\');">‹</a>';
        for(var i=beginPage;i<=endPage;i++){
            html+=i==curr?('<a title="第 '+i+' 页" class="cur">'+i+'</a>'):('<a class="valid"  title="第 '+i+' 页"  href="javascript:goToSimplePage('+i+');">'+i+'</a>');
        }
        html+=curr==totalPages?'<a title="下一页">›</a>':'<a class="valid" title="下一页"  href="javascript:goToSimplePage(\'next\');">›</a>';
        html+=curr==totalPages?'<a title="最后一页">››</a>':('<a class="valid" title="最后一页"  href="javascript:goToSimplePage('+totalPages+');">››</a>');
        html+='</span>';
         html+='<a href="javascript:goToSimplePage(\'\');" class="goto"><!--go--></a> <input type="text" id="pagetextchange" class="pagetext"><span class="count">当前页: '+curr+' / '+totalPages+'</span><span id="易做图SizeSpan" class="size">'+易做图ComplaintRecordList.易做图PageSize+'</span><span class="count">显示条数:</span>';
        $("#易做图Pages_pg").html(html).find("span#易做图SizeSpan").click(function(e){
             if($("#易做图Size_style").is(":hidden")){
                $("#易做图Size_style").css({
                    left:$(this).offset().left,
                    top:$(this).offset().top-$("#易做图Size_style").height()-2,
                    width:$(this).width()+5
                }).show();
            }else{
                $("#易做图Size_style").hide();
            }
            e.stopPropagation();
        });
  &nbs

补充:web前端 , JavaScript ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,