js 分页
2021-06-18 09:05
标签:ado open input put click line oat .ajax body js 分页 标签:ado open input put click line oat .ajax body 原文地址:http://www.cnblogs.com/yidengbone/p/7261848.htmlinput type="hidden" id="pageIndex" name="pageIndex" value="1" />
input type="hidden" id="pageCount" name="pageCount" value="0" />
input type="hidden" id="pageSize" name="pageSize" value="6" />
input type="hidden" id="recordCount" name="recordCount" value="0" />
div id="fenye" class="badoo fenye">
div class="pageMsg">
第span class="dispalyPageIndex">span>页,共span id="dispalyPageCount">span>页,每页span id="displayPageSize">span>条 共span id="displaRrecordCount">span>条
div>
div class="pageNum">
a id="firstPage">首页a>
a id="prevPage">上一页a>
span class="dispalyPageIndex">span>
a id="nextPage">下一页a>
a id="endPage">尾页a>
div>
div>
{
height: 40px;
line-height: 40px;
}
#fenye .pageMsg {
width: 40%;
float: left;
text-align: left;
color: #01479d;
}
#fenye .pageNum {
width: 60%;
float: left;
text-align: right;
}
#fenye a {
margin-right: 5px;
color: #01479d;
}
#fenye span {
margin-right: 5px;
color: #01479d;
}
#fenye .disabled {
cursor: not-allowed;
color: #989898;
}
if (parseInt($("#pageCount").val()) == parseInt($("#pageIndex").val())) {
$("#nextPage,#endPage").addClass("disabled");
$("#nextPage,#endPage").attr("href", "javascript:void(0);");
}
if (parseInt($("#pageCount").val()) == 1) {
$("#firstPage,#prevPage,#nextPage,#endPage").addClass("disabled");
$("#firstPage,#prevPage,#nextPage,#endPage").attr("href", "javascript:void(0);");
}
$("#fenye a").click(function () {
var pageIndex = parseInt($("#pageIndex").val());
var pageCount = parseInt($("#pageCount").val());
var id = $(this).attr("id");
var href = $(this).attr("href");
var curr = 1;
curr = id == "firstPage" ? 1 : parseInt(curr);
curr = id == "endPage" ? pageCount : parseInt(curr);
curr = id == "prevPage" ? parseInt(pageIndex - 1) : parseInt(curr);
curr = id == "nextPage" ? parseInt(pageIndex + 1) : parseInt(curr);
curr = curr > pageCount ? pageCount : parseInt(curr);
curr = curr : parseInt(curr);
if (href == "" || typeof (href) == "undefined") {
$("#pageIndex").val(curr);
GetContractByDept($("#DeptID").val(), ‘‘, ‘‘, ‘‘, ‘‘, ‘‘, ‘‘, $("#pageIndex").val(), $("#pageSize").val());
}
})
function GetContractByDept(deptid, actName, actNum, beginTime, endTime, operator, oppOperator, pageIndex, pageSize) {
$("#ContractList tbody tr").remove();
$("#selectAll").get(0).checked = false;
$.ajax({
url: ‘Action.ashx?t=GetContractByDeptId‘,
data: { deptid: deptid, actName: actName, actNum: actNum, beginTime: beginTime, endTime: endTime, operator: operator, oppOperator: oppOperator, pageIndex: pageIndex, pageSize: pageSize },
type: ‘POST‘,
dataType: "json",
success: function (result) {
if (result.success) {
$(result.data).each(function (index) {
var html = "";
html += "
";
html += " ";
$("#ContractList tbody").append(html);
});
$("#pageIndex").val(result.pageIndex);
$("#pageSize").val(result.pageSize);
$("#recordCount").val(result.recordCount);
$("#pageCount").val(Math.ceil(result.recordCount / result.pageSize));
$(".dispalyPageIndex").text(result.pageIndex);
$("#displayPageSize").text(result.pageSize);
$("#dispalyPageCount").text($("#pageCount").val());
$("#displaRrecordCount").text($("#recordCount").val());
if ($("#ContractList tbody tr").length ) {
$("#ContractList tbody").html("
this.ID + "&OwnerName=" + this.OwnerDisplayName + "&OwnerTime=" + this.CreateTime + "‘ data-name=‘" + this.ContractName + "‘/> ";
html += "
this.ID + "‘ data-contractName=‘" + this.ContractName + "‘ /> ";
html += "" + this.FileType + " ";
html += "" + this.ContractName + " ";
html += "" + this.FileSize + " ";
html += "" + this.OwnerDisplayName + " ";
html += "" + this.CreateTime + " ";
html += " ");
}
$("input[name=‘chkDname‘]").click(function () {
if (!$(this).isChecked) {
$("#selectAll").prop("checked", false);
}
var chsub = $("input[name=‘chkDname‘]").length;
var checkedsub = $("input[name=‘chkDname‘]:checked").length;
if (chsub == checkedsub) {
$("#selectAll").prop("checked", true);
}
});
$(".btnPower").click(function () {
var url = $(this).attr("data-url");
var name = $(this).attr("data-name");
layer.open({
type: 2,
title: name,
shadeClose: true,
shade: 0.4,
area: [‘680px‘, ‘350px‘],
content: url
});
})
} else {
$("#ContractList tbody").html("暂无数据 ");
}
}
});
}暂无数据