資料列表的全選 反選以及批量操作

2022-05-03 07:36:13 字數 860 閱讀 8547

html部分**:

1、全選的checkbox:

2、每條資料前邊的checkbox:">

js**部分:

全選與反選:

$("#all_columnid").on("click", function());

console.log(check_value);

check_value = $.grep(check_value, function(n));

if(check_value.length > 0)

}else

});$(".table").on("click","input[name='columnid']",function());

console.log(check_value);

check_value = $.grep(check_value, function(n));

var $columnid = $("input[name='columnid']");

if(check_value.length > 0)else

\(("#all_columnid").prop("checked",\)columnid.length == $columnid.filter(":checked").length ? true : false);

});操作部分:一般是批量刪除、批量審核等

$("#batch_del_fields").click(function());

//check_value就是選中的部分,陣列形式

console.log(check_value);

//在這下邊執行非同步刪除等操作

});

關於全選 反選,批量刪除

全選 反選 function checkopposite else function deletesome console.log id.substring 1 獲取id的第二種方式 map 將jquery集合轉換成其他陣列 get 將其他陣列轉換成js陣列 join 將陣列中的元素拼成字串,如果不...

jq實現批量全選與反選

doctype html html lang en head meta charset utf 8 title document title head body input type button value 刪除 table border 1 thead tr th input type chec...

TreeView樹,全選,反選,平級選操作

首先事件選擇,選擇的是mouseup事件。為啥?因為凡是跟check有關的,在選中父節點或者子節點,都會二次觸發。然後發生的就是死迴圈。up事件就可以避免二次觸發。down事件呢?那就觸發aftercheck事件了。事件選好了,直接上 處理思路 選中 取消當前節點,先選中其所有父節點,再選中其子節點...