逻辑:
1.全选:勾选时,本页勾选,单选全部勾选;取消勾选时,本页取消勾选,单选全部取消勾选
2.本页:勾选时,单选全部勾选,若勾选总数等于查询结果总数,全选也勾选;取消勾选时,本页全部取消勾选,全选取消勾选
3.单选:勾选时,判断已勾选条数,若等于本页总数,则本页勾选,若等于查询结果总数,则全选勾选;取消勾选时,本页取消勾选,全选取消勾选
变量:
1.selecteAll 全选标记
2.needContactsIds 已选择项
代码:
function bindCheckbox(){
//翻页清除本页选择
$('#selectAllByPage').removeAttr("checked");
//列表总数
totalRecords = Number($('#totalRecords').html());
//翻页之后的全选
if(selectAll){
$('#selectAllByPage').prop("checked",true);
$('#contactsView input').prop("checked",true);
needContactsIds = ",";
}
//点击全选
$('#selectAll').bind("click",function(){
if($(this).i