ajax 限制显示条数,jquery通过ajax获取数据,控制显示的数据条数

无标题文档

body { margin:0;}

table { border:1px solid #ccc;}

td,th { height:26px; font-family:"微软雅黑"; font-size:12px; padding:5px; text-align:left; border-left:1px solid #ccc;}

td {border-top:1px solid #ddd; color:#333}

#topgn { position:relative;}

#ColumnsListBox { background:#fff; position:absolute; left:0; top:20px; padding-top:5px; border:1px solid #ccc; border-bottom:none; display:none;}

.ColumnsList { font-size:12px; line-height:26px;border-bottom:1px solid #ccc; padding:0 15px 010px; cursor:pointer;}

.ColumnsList span { width:20px; height:20px; background:red; display:inline-block; vertical-align:middle; background:url(img/checkbox.png) -60px -30px; margin-right:5px;}

.ColumnsList .checkbox { background-position:right 0;}

#tablethead { display:none; position:fixed; left:0; top:0; z-index:5; width:100%;}

th { background:#288068; color:#fff;}

$(function(){

function addShuJu(iNum){var addNum=parseInt(iNum);var Html="";

$.ajax({

type:"GET",

url:"http://10.10.140.77:5566/rs_Mianshi/goo.ashx",

data:{pagesize:iNum},

dataType:"json",

success: function(ret){

console.log(ret)var date=ret[‘rows‘];var html="";for(var i=0;i

{

html+="

"

+"

"+date[i][‘RN‘]+""

+"

"+date[i][‘u_kahao‘]+""

+"

"+date[i][‘u_xingming‘]+""

+"

"+date[i][‘u_shouji‘]+""

+"

"+date[i][‘u_xingbie‘]+""

+"

"}

$("#tbody1").html(html);

},

error:function(){

}

})

};

addShuJu(10);

$("#pagechange").change(function(){

$("#tbody1").html("

正在加载中....");var aTh=$("#thead1 .thetr th");var Columnshtml="";for(var i=0;i

{

Columnshtml+="

"+aTh[i].innerHTML+"
";

}

$("#ColumnsListBox").html(Columnshtml);

$("#tablethead th").show();

aTh.show();

addShuJu($(this).val());

});

})

自动

5

10

15

20

50

号码其他序号卡号姓名电话性别

正在加载中....

$(window).scroll(function(){if($(window).scrollTop()>$("#thead1 .thetr").position().top)

{

$("#tablethead").show();

$("#thead2").html($("#thead1").html())//console.log(11);

}else{

$("#tablethead").hide();

}

})

var aTh=$("#thead1 .thetr th");var Columnshtml="";for(var i=0;i

{

Columnshtml+="

"+aTh[i].innerHTML+"
"}

$("#ColumnsListBox").html(Columnshtml);

$("#Columnsbtn").click(function(){

$("#ColumnsListBox").show();return false;

});

$("#topgn").on("click",".ColumnsList",function(){var iNmu=parseInt($(this).index())+1;var number=parseInt($("#thead1 .toptr2 th").eq($(this).attr("data-col")).attr("colspan"));if($(this).attr("date-check")=="true"){

number-=1;if(number<=0)

{

$("#thead1 .toptr2 th").eq($(this).attr("data-col")).hide();

}

$("#thead1 .toptr2 th").eq($(this).attr("data-col")).attr("colspan",number);

$("#tab1 tr td:nth-child("+iNmu+")").hide();

$(".thetr th:nth-child("+iNmu+")").hide();

$(this).find("span").addClass("checkbox");

$(this).attr("date-check","false");

}else{

number+=1;

$("#thead1 .toptr2 th").eq($(this).attr("data-col")).show();

$("#thead1 .toptr2 th").eq($(this).attr("data-col")).attr("colspan",number);

$("#tab1 tr td:nth-child("+iNmu+")").show();

$(".thetr th:nth-child("+iNmu+")").show();

$(this).find("span").removeClass("checkbox");

$(this).attr("date-check","true");

//$("#ColumnsListBox").attr(‘data-cols‘, $("#thead1 .thetr th").filter(":visible").length);

//$(".cloneTd,.noData").attr(‘colspan‘, $("#thead1 .thetr th").filter(":visible").length);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值