1.分页
html部分
<div id="pageTool">
</div>
js部分
$('#pageTool').Paging({
prevTpl: "<",
nextTpl: ">",
pagesize: pageSize,//页面显示条数
count: r.totalResultCount,//总共页数
current: pageNum,//很重要 分页显示当前页数
toolbar: true,
pageSizeList: [10, 20, 50, 100],
callback: function(page, size, count) {
pageNum = page;
getList();
flag = false;
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
});
$("#pageTool").find(".ui-paging-container:last").siblings().remove();
$("#pageTool").find(".ui-paging-container ul").append("<li class='totalResultCount'>总共有" + r.totalResultCount + "条记录</li>");
$(".ui-select-pagesize").unbind("change").change(function() {
pageSize = $('.ui-select-pagesize').val();
pageNum = 1;
getList();
});
2.全选全不选
html部分
<table class="table table-hover">
<tr>
<th>
<input type="checkbox" id="allCheck" name="" value="">
</th>
<th>序号</th>
<th>表名</th>
<th>表名称</th>
<th>操作</th>
</tr>
<c:forEach var="type" items="<%=typeList%>">
<tr class="tr${type}">
<td><input class="check" type="checkbox"><input class="" type="hidden" name="types" value="${type}"></td>
<td class="serialNumber"></td>
<td class="tableNameUpper">${type}</td>
<td class="tableNameCN">${type}</td>
<td class="${type}Td lastTd"><a>勾稽验证</a></td>
</tr>
</c:forEach>
</table>
js部分
//选中
$(".check").unbind("change").change(function() {
var checkFlag = true,
_this = "";
types = [];//存每条记录id值用的
$(".check").each(function(index, el) {
_this = $(".check").eq(index);
if (_this.prop("checked") == true) {
types.push($(this).next().val());
} else {
checkFlag = false;
}
});
if (checkFlag) {
$("#allCheck").prop("checked", true);
} else {
$("#allCheck").prop("checked", false);
}
});
//全选
$("#allCheck").on("change", function() {
if ($(this).is(":checked") == true) {
types = [];
typeUrl=""
$(".check").prop("checked", true);
$(".check").each(function(index, el) {
types.push($(this).next().val());
});
} else {
$(".check").prop("checked", false);
types = [];
}
});